Submission #1988524
Source Code Expand
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<bitset>
#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007LL
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};
ll productmod(ll x, ll y){
if(x*y >= MOD) return (x*y) % MOD;
else return x*y;
}
int main(){
std::ios::sync_with_stdio(0); cin.tie(0);
int n;
scanf("%d", &n);
vector<Pii> a(2*n);
rep(n){
scanf("%d", &a[i].first);
a[i].second = 1;
}
rep(n){
scanf("%d", &a[n+i].first);
a[n+i].second = 0;
}
sort(all(a));
ll ans = 1LL;
ll cnt[2] = {0, 0};
rep(2*n){
if(cnt[1-a[i].second] == 0){
cnt[a[i].second]++;
}else{
ans = productmod(ans, cnt[1-a[i].second]);
cnt[1-a[i].second]--;
}
}
printf("%lld\n", ans);
}
Submission Info
Submission Time |
|
Task |
A - 1D Matching |
User |
Noimin |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1320 Byte |
Status |
AC |
Exec Time |
40 ms |
Memory |
1792 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:39:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:42:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &a[i].first);
^
./Main.cpp:46:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &a[n+i].first);
^
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 |
24 ms |
1152 KB |
001.txt |
AC |
9 ms |
640 KB |
002.txt |
AC |
13 ms |
768 KB |
003.txt |
AC |
14 ms |
768 KB |
004.txt |
AC |
36 ms |
1664 KB |
005.txt |
AC |
40 ms |
1792 KB |
006.txt |
AC |
40 ms |
1792 KB |
007.txt |
AC |
39 ms |
1792 KB |
008.txt |
AC |
40 ms |
1792 KB |
009.txt |
AC |
40 ms |
1792 KB |
010.txt |
AC |
39 ms |
1792 KB |
011.txt |
AC |
39 ms |
1792 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
AC |
1 ms |
256 KB |