Submission #1000594
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], 1 });
}
sort(eve.begin(), eve.end());
i64 ret = 1;
int ch = 0;
for (auto e : eve) {
int ki = e.second;
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:09:18+0900
Task
A - 1D Matching
User
semiexp
Language
C++14 (GCC 5.4.1)
Score
500
Code Size
1026 Byte
Status
AC
Exec Time
47 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
500 / 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
AC
29 ms
1912 KB
001.txt
AC
12 ms
1020 KB
002.txt
AC
15 ms
1148 KB
003.txt
AC
17 ms
1656 KB
004.txt
AC
42 ms
3060 KB
005.txt
AC
47 ms
3188 KB
006.txt
AC
47 ms
3188 KB
007.txt
AC
47 ms
3188 KB
008.txt
AC
47 ms
3188 KB
009.txt
AC
47 ms
3188 KB
010.txt
AC
46 ms
3188 KB
011.txt
AC
46 ms
3188 KB
example0.txt
AC
2 ms
256 KB
example1.txt
AC
2 ms
256 KB