Submission #3416094
Source Code Expand
#include<algorithm> #include<iostream> #include<cstring> #include<cstdio> #include<cmath> #define LL long long #define M 400020 using namespace std; int read(){ int nm=0,fh=1; int cw=getchar(); for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh; for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0'); return nm*fh; } int H,W,n,X[M],Y[M],XX[M],YY[M],L[M<<2],R[M<<2],od[M<<2]; bool on(int x,int y){return x==0||y==0||x==H||y==W;} int bas(int x,int y){if(!x)return y;if(y==W)return W+x;if(x==H)return W+H+W-y;return W+H+W-x;} bool cmp(int x,int y){return R[x]<R[y]||(R[x]==R[y]&&L[x]>L[y]);} int main(){ //freopen(".in","r",stdin); //freopen(".out","w",stdout); H=read(),W=read(),n=read(); for(int i=1;i<=n;i++){ X[i]=read(),Y[i]=read(),XX[i]=read(),YY[i]=read(),od[i]=i; if(!on(X[i],Y[i])||!on(XX[i],YY[i])) i--,n--; L[i]=bas(X[i],Y[i]),R[i]=bas(XX[i],YY[i]); if(L[i]>R[i]) swap(L[i],R[i]); } sort(od+1,od+n+1,cmp); for(int i=2;i<=n;i++) if(L[od[i-1]]<L[od[i]]&&R[od[i-1]]<R[od[i]]&&L[od[i]]<R[od[i-1]]){puts("NO");return 0;} puts("YES"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Connected? |
User | OYJason |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1094 Byte |
Status | WA |
Exec Time | 40 ms |
Memory | 10880 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt, s4.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 43.txt, 44.txt, 45.txt, 46.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 34 ms | 10752 KB |
02.txt | WA | 35 ms | 10752 KB |
03.txt | WA | 36 ms | 10752 KB |
04.txt | WA | 31 ms | 10496 KB |
05.txt | WA | 36 ms | 10752 KB |
06.txt | WA | 38 ms | 10880 KB |
07.txt | AC | 32 ms | 10496 KB |
08.txt | AC | 37 ms | 10752 KB |
09.txt | AC | 34 ms | 10624 KB |
10.txt | AC | 39 ms | 10880 KB |
11.txt | AC | 37 ms | 10752 KB |
12.txt | WA | 29 ms | 10496 KB |
13.txt | WA | 32 ms | 10624 KB |
14.txt | AC | 32 ms | 10624 KB |
15.txt | AC | 34 ms | 10624 KB |
16.txt | WA | 31 ms | 10496 KB |
17.txt | WA | 30 ms | 10496 KB |
18.txt | WA | 29 ms | 10496 KB |
19.txt | AC | 32 ms | 10624 KB |
20.txt | AC | 39 ms | 10880 KB |
21.txt | AC | 34 ms | 10624 KB |
22.txt | AC | 34 ms | 10624 KB |
23.txt | AC | 39 ms | 10880 KB |
24.txt | AC | 39 ms | 10880 KB |
25.txt | WA | 39 ms | 10880 KB |
26.txt | AC | 40 ms | 10880 KB |
27.txt | AC | 39 ms | 10880 KB |
28.txt | AC | 38 ms | 10880 KB |
29.txt | AC | 40 ms | 10880 KB |
30.txt | AC | 39 ms | 10880 KB |
43.txt | AC | 2 ms | 10496 KB |
44.txt | AC | 3 ms | 10496 KB |
45.txt | AC | 2 ms | 10496 KB |
46.txt | AC | 2 ms | 10496 KB |
s1.txt | AC | 2 ms | 10496 KB |
s2.txt | AC | 2 ms | 10496 KB |
s3.txt | AC | 3 ms | 10496 KB |
s4.txt | AC | 2 ms | 10496 KB |