Submission #1000591
Source Code Expand
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <iostream>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;
int N, A[101010], B[101010];
int main()
{
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);
vector<pair<int, int> > eve;
for (int i = 0; i < N; ++i) {
eve.push_back({ A[i], 0 });
}
for (int i = 0; i < N; ++i) {
eve.push_back({ B[i], 0 });
}
sort(eve.begin(), eve.end());
i64 ret = 1;
int ch = 0;
for (auto e : eve) {
int ki = e.first;
if (ki == 1) {
if (ch < 0) ret = ret * (-ch) % MOD;
++ch;
} else {
if (ch > 0) ret = ret * ch % MOD;
--ch;
}
}
printf("%lld\n", ret);
return 0;
}
Submission Info
Submission Time
2016-11-28 12:08:40+0900
Task
A - 1D Matching
User
semiexp
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1025 Byte
Status
WA
Exec Time
48 ms
Memory
3188 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:24:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
./Main.cpp:25:48: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i = 0; i < N; ++i) scanf("%d", A + i);
^
./Main.cpp:26:48: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i = 0; i < N; ++i) scanf("%d", B + i);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 500
Status
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
WA
29 ms
1912 KB
001.txt
WA
12 ms
1020 KB
002.txt
WA
16 ms
1148 KB
003.txt
WA
18 ms
1656 KB
004.txt
WA
43 ms
3060 KB
005.txt
WA
47 ms
3188 KB
006.txt
WA
47 ms
3188 KB
007.txt
WA
47 ms
3188 KB
008.txt
WA
48 ms
3188 KB
009.txt
WA
47 ms
3188 KB
010.txt
WA
47 ms
3188 KB
011.txt
AC
47 ms
3188 KB
example0.txt
WA
3 ms
256 KB
example1.txt
AC
3 ms
256 KB