Submission #65884657


Source Code Expand

Copy
h,w,n=map(int,input().split())
from sortedcontainers import SortedSet
X=[SortedSet() for _ in range(w)]
Y=[SortedSet() for _ in range(h)]
for _ in range(n):
x,y=map(int,input().split())
x-=1
y-=1
X[y].add(x)
Y[x].add(y)
for _ in range(int(input())):
q,xy=map(int,input().split())
q-=1
xy-=1
if q:
print(len(X[xy]))
for yy in X[xy]:
Y[yy].discard(xy)
X[xy]=SortedSet()
else:
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
h,w,n=map(int,input().split())
from sortedcontainers import SortedSet
X=[SortedSet() for _ in range(w)]
Y=[SortedSet() for _ in range(h)]

for _ in range(n):
    x,y=map(int,input().split())
    x-=1
    y-=1
    X[y].add(x)
    Y[x].add(y)
for _ in range(int(input())):
    q,xy=map(int,input().split())
    q-=1
    xy-=1
    if q:
        print(len(X[xy]))
        for yy in X[xy]:
            Y[yy].discard(xy)
        X[xy]=SortedSet()
    else:
        print(len(Y[xy]))
        for yy in Y[xy]:
            X[yy].discard(xy)
        Y[xy]=SortedSet()

Submission Info

Submission Time
Task D - Garbage Removal
User juten
Language Python (PyPy 3.10-v7.3.12)
Score 0
Code Size 581 Byte
Status TLE
Exec Time 2790 ms
Memory 593912 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 28
TLE × 12
Set Name Test Cases
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt, testcase33.txt, testcase34.txt, testcase35.txt, testcase36.txt
Case Name Status Exec Time Memory
sample00.txt AC 126 ms 85800 KB
sample01.txt AC 125 ms 86012 KB
sample02.txt AC 126 ms 85916 KB
testcase00.txt AC 1483 ms 336140 KB
testcase01.txt TLE 2788 ms 555576 KB
testcase02.txt AC 728 ms 232268 KB
testcase03.txt TLE 2788 ms 556948 KB
testcase04.txt AC 2405 ms 419536 KB
testcase05.txt TLE 2788 ms 556496 KB
testcase06.txt AC 1523 ms 245220 KB
testcase07.txt TLE 2788 ms 555116 KB
testcase08.txt TLE 2790 ms 593912 KB
testcase09.txt AC 1526 ms 326572 KB
testcase10.txt AC 2281 ms 520760 KB
testcase11.txt AC 1563 ms 321704 KB
testcase12.txt AC 2191 ms 519076 KB
testcase13.txt AC 1567 ms 397476 KB
testcase14.txt AC 2142 ms 488360 KB
testcase15.txt AC 1177 ms 336240 KB
testcase16.txt AC 2041 ms 486908 KB
testcase17.txt AC 1210 ms 390104 KB
testcase18.txt AC 2167 ms 488640 KB
testcase19.txt AC 877 ms 302424 KB
testcase20.txt AC 2057 ms 486564 KB
testcase21.txt AC 1639 ms 460488 KB
testcase22.txt TLE 2585 ms 556240 KB
testcase23.txt AC 1386 ms 417732 KB
testcase24.txt AC 2398 ms 552392 KB
testcase25.txt AC 2059 ms 472996 KB
testcase26.txt TLE 2787 ms 541644 KB
testcase27.txt AC 1788 ms 468856 KB
testcase28.txt TLE 2686 ms 542092 KB
testcase29.txt AC 1418 ms 415876 KB
testcase30.txt TLE 2787 ms 542888 KB
testcase31.txt AC 1608 ms 410868 KB
testcase32.txt TLE 2609 ms 546504 KB
testcase33.txt AC 1201 ms 340196 KB
testcase34.txt TLE 2711 ms 553540 KB
testcase35.txt AC 1217 ms 360388 KB
testcase36.txt TLE 2531 ms 552020 KB


2025-05-17 (Sat)
22:42:44 +09:00