Submission #3623787


Source Code Expand

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
ll mod = 1e9+7;
pii a[20005];
int main(){
    int n;
    scanf("%d", &n);
    rep(i,2*n){
        scanf("%d", &a[i].first);
        a[i].second = i;
    }
    sort(a,a+2*n);
    ll ans = 1;
    int hoge = 0;
    rep(i,2*n){
        if(a[i].second < n){
            if(hoge< 0) ans = ans * (-hoge) % mod;
            hoge++;
        }else{
            if(hoge > 0) ans = ans * hoge % mod;
            hoge--;
        }
    }
    printf("%lld\n", ans);
}

Submission Info

Submission Time
Task A - 1D Matching
User polyomino
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1083 Byte
Status RE
Exec Time 99 ms
Memory 384 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
./Main.cpp:34:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i].first);
                                 ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 2
RE × 12
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 99 ms 384 KB
001.txt RE 99 ms 384 KB
002.txt RE 99 ms 384 KB
003.txt RE 99 ms 384 KB
004.txt RE 99 ms 384 KB
005.txt RE 99 ms 384 KB
006.txt RE 98 ms 384 KB
007.txt RE 98 ms 384 KB
008.txt RE 98 ms 384 KB
009.txt RE 98 ms 384 KB
010.txt RE 99 ms 384 KB
011.txt RE 98 ms 384 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB