99462024-03-20 23:04:4642Ütős helyzet (75 pont)python3Accepted 75/7520ms13280 KiB
# O(N)

from sys import stdin
input=stdin.readline

def solv():
    N = int(input())
    cur=set()
    for _ in range(N):
        T,X,Y = [int(x) for x in input().split()]
        if T==3:
            print('-')
            cur.discard((1,X,Y))
            cur.discard((2,X,Y))
        elif T==2:
            ok=True
            for t,x,y in cur:
                if X==x or Y==y or abs(X-x)==abs(Y-y):
                    print('NEM')
                    ok=False
                    break
            if ok:
                print('IGEN')
                cur.add((T,X,Y))
        else:
            ok=True
            for t,x,y in cur:
                if X==x or Y==y or (t==2 and abs(X-x)==abs(Y-y)):
                    print('NEM')
                    ok=False
                    break
            if ok:
                print("IGEN")
                cur.add((T,X,Y))
    
solv()
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms11192 KiB
2Accepted0/020ms11576 KiB
3Accepted2/217ms11744 KiB
4Accepted2/218ms11988 KiB
5Accepted3/318ms11964 KiB
6Accepted3/319ms11916 KiB
7Accepted5/519ms12344 KiB
8Accepted6/620ms12492 KiB
9Accepted6/619ms12660 KiB
10Accepted6/619ms13036 KiB
11Accepted6/620ms13012 KiB
12Accepted6/620ms13100 KiB
13Accepted6/619ms12712 KiB
14Accepted6/619ms13120 KiB
15Accepted6/619ms13172 KiB
16Accepted6/619ms13068 KiB
17Accepted6/619ms13280 KiB