Submission #1003309


Source Code Expand

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cassert>

using namespace std;

#define TASKNAME ""

void solve(int test_number);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(9);
    cerr.setf(ios::fixed);
    cerr.precision(3);
#ifdef LOCAL
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#else
#endif
    int n = 1;
    for (int i = 0; i < n; i++) {
        solve(i);
    }
}

const int MAX_N = 200005;
const int MOD = 1000000007;


int n, a[MAX_N], b[MAX_N];

void solve(int test_number) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &b[i]);
    }
    sort(a, a + n);
    sort(b, b + n);
    long long ans = 1;
    int var = 0;
    int i = 0, j = 0;
    assert(false);
    while (i < n || j < n) {
        if (i < n) {
            while (j < n && b[j] <= a[i]) {
                var++;
                j++;
            }
        }
        if (var) {
            ans = ans * var % MOD;
            i++;
            var--;
        } else {
            swap(a, b);
            swap(i, j);
        }
    }
    printf("%lld\n", ans);
}

Submission Info

Submission Time
Task A - 1D Matching
User Sarkin
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1488 Byte
Status RE
Exec Time 150 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
RE × 2
RE × 14
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt RE 133 ms 768 KB
001.txt RE 119 ms 384 KB
002.txt RE 122 ms 640 KB
003.txt RE 124 ms 512 KB
004.txt RE 144 ms 1024 KB
005.txt RE 149 ms 1024 KB
006.txt RE 148 ms 1024 KB
007.txt RE 148 ms 1024 KB
008.txt RE 148 ms 1024 KB
009.txt RE 148 ms 1024 KB
010.txt RE 150 ms 1024 KB
011.txt RE 149 ms 1024 KB
example0.txt RE 113 ms 256 KB
example1.txt RE 112 ms 256 KB