Submission #2172391
Source Code Expand
#include <bits/stdc++.h> //#include <math.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define pb push_back #define pf push_front #define fi first #define se second #define BIT(x,n) bitset<n>(x) #define PI 3.14159265358979323846 typedef long long ll; //typedef pair<int,int> P; //typedef pair<int,P> PP; //----------------------------------------------------------------------------- int n; int a[100000],b[100000]; const int MOD=1e9+7; map<ll,int> mp; ll calc(int m) { ll res=1; while(m>0) (res*=m)%=MOD,m--; return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin>>n; REP(i,n) cin>>a[i]; REP(i,n) cin>>b[i]; sort(a,a+n);sort(b,b+n); REP(i,n) { mp[b[i]-a[i]]++; } ll ans=1; for(auto v:mp) (ans*=calc(v.se))%=MOD; cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | moko_freedom |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 963 Byte |
Status | WA |
Exec Time | 59 ms |
Memory | 7296 KB |
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 | 33 ms | 4480 KB |
001.txt | WA | 12 ms | 1792 KB |
002.txt | WA | 17 ms | 2432 KB |
003.txt | WA | 19 ms | 2688 KB |
004.txt | WA | 50 ms | 6528 KB |
005.txt | WA | 56 ms | 7168 KB |
006.txt | WA | 55 ms | 7168 KB |
007.txt | WA | 55 ms | 7168 KB |
008.txt | WA | 55 ms | 7296 KB |
009.txt | WA | 59 ms | 7168 KB |
010.txt | WA | 57 ms | 7168 KB |
011.txt | WA | 52 ms | 2816 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | WA | 1 ms | 256 KB |