Submission #1867353
Source Code Expand
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; #define MOD 1000000007 typedef long long ll; typedef pair<ll,ll>P; ll fact[200000],cnt[2]; int main(){ int n;scanf("%d",&n); fact[0]=1;for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%MOD; vector<P>v; rep(j,2)rep(i,n){ int a;scanf("%d",&a); v.push_back(P(a,j)); } sort(v.begin(),v.end()); int ans=1; for(auto p:v){ if(cnt[!p.second]){ (ans*=fact[cnt[!p.second]])%=MOD; cnt[!p.second]--; } else cnt[p.second]++; } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | autumn_eel |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 563 Byte |
Status | WA |
Exec Time | 43 ms |
Memory | 7152 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int n;scanf("%d",&n); ^ ./Main.cpp:14:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int a;scanf("%d",&a); ^
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 | 26 ms | 2932 KB |
001.txt | WA | 10 ms | 1528 KB |
002.txt | WA | 13 ms | 1656 KB |
003.txt | WA | 15 ms | 2676 KB |
004.txt | WA | 38 ms | 6384 KB |
005.txt | WA | 43 ms | 6512 KB |
006.txt | WA | 43 ms | 6768 KB |
007.txt | WA | 42 ms | 7152 KB |
008.txt | WA | 42 ms | 6640 KB |
009.txt | WA | 42 ms | 5360 KB |
010.txt | WA | 42 ms | 5360 KB |
011.txt | AC | 42 ms | 6384 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |