Submission #1988383
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;};
int main(){
std::ios::sync_with_stdio(0); cin.tie(0);
int n;
scanf("%d", &n);
vector<int> a(n), b(n);
rep(n) scanf("%d", &a[i]);
rep(n) scanf("%d", &b[i]);
sort(all(a));
map<int, int> mp;
rep(n) mp[abs(a[i]-b[i])]++;
ll fact[n+1];
fact[0] = fact[1] = 1;
reppp(i, 2, n+1) fact[i] = (fact[i-1] * (ll)i) % MOD;
ll ans = 1LL;
for(auto itr=mp.begin();itr!=mp.end();++itr){
(ans *= fact[itr->second]) %= MOD;
}
printf("%lld\n", ans);
}
Submission Info
Submission Time |
|
Task |
A - 1D Matching |
User |
Noimin |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1166 Byte |
Status |
WA |
Exec Time |
66 ms |
Memory |
6528 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:34:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:36:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(n) scanf("%d", &a[i]);
^
./Main.cpp:37:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(n) 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 |
37 ms |
4096 KB |
001.txt |
WA |
13 ms |
1664 KB |
002.txt |
WA |
19 ms |
2176 KB |
003.txt |
WA |
20 ms |
2432 KB |
004.txt |
WA |
56 ms |
5888 KB |
005.txt |
WA |
64 ms |
6528 KB |
006.txt |
WA |
64 ms |
6528 KB |
007.txt |
WA |
64 ms |
6528 KB |
008.txt |
WA |
64 ms |
6528 KB |
009.txt |
WA |
64 ms |
6528 KB |
010.txt |
WA |
66 ms |
6528 KB |
011.txt |
WA |
64 ms |
6528 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
WA |
1 ms |
256 KB |