Submission #65887938


Source Code Expand

Copy
h,w,n=map(int,input().split())
X=[set() for _ in range(w)]
Y=[set() 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)
vis=set()
for _ in range(int(input())):
q,xy=map(int,input().split())
q-=1
xy-=1
if (q,xy) in vis:
print(0)
continue
if q:
print(len(X[xy]))
for yy in X[xy]:
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
h,w,n=map(int,input().split())
X=[set() for _ in range(w)]
Y=[set() 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)
vis=set()
for _ in range(int(input())):
    q,xy=map(int,input().split())
    q-=1
    xy-=1
    if (q,xy) in vis:
        print(0)
        continue
    if q:
        print(len(X[xy]))
        for yy in X[xy]:
            Y[yy].discard(xy)
        X[xy].clear()
    else:
        print(len(Y[xy]))
        for yy in Y[xy]:
            X[yy].discard(xy)
        Y[xy].clear()
    vis.add((q,xy))

Submission Info

Submission Time
Task D - Garbage Removal
User juten
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 612 Byte
Status AC
Exec Time 1043 ms
Memory 214172 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 40
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 56 ms 76472 KB
sample01.txt AC 56 ms 76352 KB
sample02.txt AC 56 ms 76256 KB
testcase00.txt AC 557 ms 117120 KB
testcase01.txt AC 840 ms 176192 KB
testcase02.txt AC 241 ms 112404 KB
testcase03.txt AC 1043 ms 185056 KB
testcase04.txt AC 668 ms 148832 KB
testcase05.txt AC 839 ms 176708 KB
testcase06.txt AC 424 ms 117808 KB
testcase07.txt AC 859 ms 177520 KB
testcase08.txt AC 889 ms 214172 KB
testcase09.txt AC 533 ms 124384 KB
testcase10.txt AC 717 ms 147072 KB
testcase11.txt AC 582 ms 128584 KB
testcase12.txt AC 627 ms 143088 KB
testcase13.txt AC 373 ms 138252 KB
testcase14.txt AC 631 ms 162816 KB
testcase15.txt AC 286 ms 134664 KB
testcase16.txt AC 629 ms 164440 KB
testcase17.txt AC 267 ms 130748 KB
testcase18.txt AC 637 ms 160548 KB
testcase19.txt AC 268 ms 108412 KB
testcase20.txt AC 607 ms 161928 KB
testcase21.txt AC 424 ms 143132 KB
testcase22.txt AC 692 ms 179796 KB
testcase23.txt AC 295 ms 157056 KB
testcase24.txt AC 659 ms 178544 KB
testcase25.txt AC 614 ms 163648 KB
testcase26.txt AC 751 ms 180328 KB
testcase27.txt AC 468 ms 143672 KB
testcase28.txt AC 726 ms 176848 KB
testcase29.txt AC 325 ms 126148 KB
testcase30.txt AC 740 ms 183872 KB
testcase31.txt AC 499 ms 136676 KB
testcase32.txt AC 701 ms 182452 KB
testcase33.txt AC 328 ms 123448 KB
testcase34.txt AC 706 ms 179700 KB
testcase35.txt AC 405 ms 109956 KB
testcase36.txt AC 670 ms 178532 KB


2025-05-17 (Sat)
22:43:06 +09:00