Submission #2165402
Source Code Expand
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}
const int P = 1e9 + 7;
int main(){
int n , x;
scanf("%d",&n);
vector<pii> v;
rep(i,0,n) {
scanf("%d",&x);
v.pb(mp(x , 0));
}
rep(i,0,n) {
scanf("%d",&x);
v.pb(mp(x , 1));
}
sort(all(v));
int cnt = 0 , type = 0;
int ans = 1;
for(auto e : v) {
if(cnt && type != e.se) {
ans = ll(ans) * cnt % P;
--cnt;
} else {
type = e.se;
++cnt;
}
}
printf("%d\n",ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - 1D Matching |
User |
Y_UME |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1253 Byte |
Status |
AC |
Exec Time |
41 ms |
Memory |
2420 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:41:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:44:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&x);
^
./Main.cpp:48:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&x);
^
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 |
25 ms |
1400 KB |
001.txt |
AC |
10 ms |
892 KB |
002.txt |
AC |
13 ms |
892 KB |
003.txt |
AC |
15 ms |
1400 KB |
004.txt |
AC |
37 ms |
2420 KB |
005.txt |
AC |
41 ms |
2420 KB |
006.txt |
AC |
41 ms |
2420 KB |
007.txt |
AC |
41 ms |
2420 KB |
008.txt |
AC |
41 ms |
2420 KB |
009.txt |
AC |
41 ms |
2420 KB |
010.txt |
AC |
41 ms |
2420 KB |
011.txt |
AC |
41 ms |
2420 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
AC |
1 ms |
256 KB |