Submission #2107337
Source Code Expand
import sys def main(): # res = [] inps = map(lambda s: s.strip(), sys.stdin.readlines()) iid = 0 r, c, n = map(int, inps[iid].split()) iid += 1 def boundary(x,y): if x==0 or y==0 or x==r or y==c: return True return False def downright(x, y): if x==0 or y==c: return True return False points = [] dr = [] ul = [] for i in xrange(1,n+1): x1, y1, x2, y2 = map(int, inps[iid].split()) iid += 1 if boundary(x1, y1) and boundary(x2, y2): if downright(x1,y1): dr.append((x1,y1,i)) else: ul.append((x1,y1,i)) if downright(x2,y2): dr.append((x2,y2,i)) else: ul.append((x2,y2,i)) dr.sort() ul.sort(reverse=True) dr.extend(ul) # print dr stack = [] for elem in dr: if len(stack)!=0 and stack[-1]==elem[2]: stack.pop() else: stack.append(elem[2]) if len(stack)==0: print "YES" else: print "NO" # print '\n'.join(res) if __name__ == '__main__': main()
Submission Info
Submission Time | |
---|---|
Task | E - Connected? |
User | vjudge2 |
Language | PyPy2 (5.6.0) |
Score | 700 |
Code Size | 1176 Byte |
Status | AC |
Exec Time | 792 ms |
Memory | 111596 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 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 | AC | 625 ms | 96464 KB |
02.txt | AC | 484 ms | 90280 KB |
03.txt | AC | 521 ms | 92736 KB |
04.txt | AC | 289 ms | 80236 KB |
05.txt | AC | 486 ms | 92208 KB |
06.txt | AC | 725 ms | 103980 KB |
07.txt | AC | 231 ms | 79480 KB |
08.txt | AC | 569 ms | 96276 KB |
09.txt | AC | 393 ms | 86576 KB |
10.txt | AC | 662 ms | 103752 KB |
11.txt | AC | 589 ms | 98260 KB |
12.txt | AC | 138 ms | 75568 KB |
13.txt | AC | 264 ms | 78616 KB |
14.txt | AC | 424 ms | 84884 KB |
15.txt | AC | 415 ms | 88640 KB |
16.txt | AC | 204 ms | 77956 KB |
17.txt | AC | 180 ms | 77352 KB |
18.txt | AC | 173 ms | 75568 KB |
19.txt | AC | 342 ms | 81896 KB |
20.txt | AC | 748 ms | 107292 KB |
21.txt | AC | 397 ms | 86320 KB |
22.txt | AC | 453 ms | 87192 KB |
23.txt | AC | 781 ms | 109412 KB |
24.txt | AC | 792 ms | 109288 KB |
25.txt | AC | 785 ms | 105268 KB |
26.txt | AC | 765 ms | 111596 KB |
27.txt | AC | 752 ms | 106788 KB |
28.txt | AC | 755 ms | 105308 KB |
29.txt | AC | 762 ms | 105136 KB |
30.txt | AC | 750 ms | 104992 KB |
43.txt | AC | 36 ms | 27756 KB |
44.txt | AC | 35 ms | 27244 KB |
45.txt | AC | 34 ms | 27628 KB |
46.txt | AC | 34 ms | 27884 KB |
s1.txt | AC | 35 ms | 28012 KB |
s2.txt | AC | 35 ms | 27884 KB |
s3.txt | AC | 35 ms | 27884 KB |
s4.txt | AC | 35 ms | 27628 KB |