Submission #3735106
Source Code Expand
#include <stdio.h>
#include <algorithm>
#define mod 1000000007
typedef long long ll;
int main(void) {
ll i, j, k, n, ans = 1, now = 0;
scanf("%lld", &n);
ll a[n], b[n];
for(i = 0; i < n; ++i) scanf("%lld", &a[i]);
for(i = 0; i < n; ++i) scanf("%lld", &b[i]);
std::sort(a, a + n), std::sort(b, b + n);
for(i = 0; i < n; ++i) {
if(a[i] < b[i]) {
while(a[now] < b[i] && now < n) ++now;
ans *= now - i;
} else {
while(b[now] < a[i] && now < n) ++now;
ans *= now - i;
}
ans %= mod;
}
printf("%lld", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - 1D Matching |
User |
masa002 |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
596 Byte |
Status |
AC |
Exec Time |
36 ms |
Memory |
1664 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:8:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &n);
^
./Main.cpp:10:46: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(i = 0; i < n; ++i) scanf("%lld", &a[i]);
^
./Main.cpp:11:46: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(i = 0; i < n; ++i) scanf("%lld", &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 |
22 ms |
1152 KB |
001.txt |
AC |
8 ms |
512 KB |
002.txt |
AC |
11 ms |
640 KB |
003.txt |
AC |
12 ms |
640 KB |
004.txt |
AC |
32 ms |
1536 KB |
005.txt |
AC |
36 ms |
1664 KB |
006.txt |
AC |
36 ms |
1664 KB |
007.txt |
AC |
36 ms |
1664 KB |
008.txt |
AC |
36 ms |
1664 KB |
009.txt |
AC |
36 ms |
1664 KB |
010.txt |
AC |
36 ms |
1664 KB |
011.txt |
AC |
36 ms |
1664 KB |
example0.txt |
AC |
1 ms |
128 KB |
example1.txt |
AC |
1 ms |
128 KB |