Submission #1051062
Source Code Expand
#include<stdio.h> #include<algorithm> #include<cstdlib> 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, 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++){ int t1 = abs(s), t2; s += w[i].ck*2-1; t2 = abs(s); if(t2 < t1){ res = res*t1%1000000007; } } printf("%lld\n",res); }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | ainta |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 593 Byte |
Status | AC |
Exec Time | 41 ms |
Memory | 1664 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:15:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:17: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 | 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 | 25 ms | 1152 KB |
001.txt | AC | 10 ms | 512 KB |
002.txt | AC | 15 ms | 640 KB |
003.txt | AC | 14 ms | 640 KB |
004.txt | AC | 37 ms | 1536 KB |
005.txt | AC | 41 ms | 1664 KB |
006.txt | AC | 41 ms | 1664 KB |
007.txt | AC | 41 ms | 1664 KB |
008.txt | AC | 41 ms | 1664 KB |
009.txt | AC | 41 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 |