27622023-01-22 15:00:46kristofZsonglőrködéspython3Time limit exceeded 0/1001.59s46580 KiB
N = int(input())

myDict = {}

for i in range(N):
    b, j = input().split()
    b = int(b)
    j = int(j)
    if b in myDict:
        myDict[b].append(j)
    else:
        myDict[b] = [j]

mostani = int(min(myDict))
szamlalo = 1

while len(myDict) > 0:
    #print(mostani, myDict.keys())
    if mostani in list(myDict.keys()):
        temp = int(mostani)
        mostani = int(myDict[mostani][0])
        if len(myDict[temp]) > 1:
            myDict[temp].pop()
        else:
            del myDict[temp]

    else:
        szamlalo += 1
        mostani = min(myDict)

print(szamlalo)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted18ms11336 KiB
2Accepted17ms11472 KiB
subtask20/20
3Accepted173ms12464 KiB
4Time limit exceeded1.567s15900 KiB
5Time limit exceeded1.557s31980 KiB
6Time limit exceeded1.58s44720 KiB
7Time limit exceeded1.585s44900 KiB
8Time limit exceeded1.542s45072 KiB
9Time limit exceeded1.565s45092 KiB
10Time limit exceeded1.57s45200 KiB
11Time limit exceeded1.574s45280 KiB
subtask30/35
12Accepted17ms12700 KiB
13Wrong answer17ms13036 KiB
14Wrong answer18ms13304 KiB
15Wrong answer18ms13264 KiB
16Wrong answer20ms13268 KiB
17Wrong answer35ms13644 KiB
18Wrong answer20ms13568 KiB
19Wrong answer37ms14036 KiB
20Wrong answer35ms13840 KiB
subtask40/45
21Accepted172ms14416 KiB
22Wrong answer246ms18628 KiB
23Time limit exceeded1.577s33692 KiB
24Wrong answer663ms28948 KiB
25Time limit exceeded1.577s46580 KiB
26Wrong answer757ms30644 KiB
27Time limit exceeded1.59s46392 KiB
28Wrong answer781ms30648 KiB
29Time limit exceeded1.562s46528 KiB