Submission #1051059
Source Code Expand
#include<stdio.h> #include<algorithm> using namespace std; struct point{ int ck, x; bool operator<(const point &p)const{ return x<p.x; } }w[201000]; int n, s; long long res = 1; int main(){ int i, pv = -1, j; scanf("%d",&n); for(i=0;i<2*n;i++){ scanf("%d",&w[i].x); w[i].ck = i/n; } sort(w,w+2*n); for(i=0;i<2*n;i++){ s += w[i].ck*2-1; if(!s){ for(j=1;j<=(i-pv)/2;j++)res=res*j%1000000007; pv = i; } } printf("%lld\n",res); }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | ainta |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 568 Byte |
Status | WA |
Exec Time | 41 ms |
Memory | 1664 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:14:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:16:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&w[i].x); ^
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 | 24 ms | 1152 KB |
001.txt | WA | 9 ms | 512 KB |
002.txt | WA | 13 ms | 640 KB |
003.txt | WA | 14 ms | 640 KB |
004.txt | WA | 36 ms | 1536 KB |
005.txt | WA | 40 ms | 1664 KB |
006.txt | WA | 41 ms | 1664 KB |
007.txt | WA | 40 ms | 1664 KB |
008.txt | WA | 40 ms | 1664 KB |
009.txt | WA | 40 ms | 1664 KB |
010.txt | AC | 40 ms | 1664 KB |
011.txt | AC | 40 ms | 1664 KB |
example0.txt | AC | 1 ms | 128 KB |
example1.txt | AC | 1 ms | 128 KB |