Submission #3540099

Source Code Expand

Copy
from collections import defaultdict
N, M = map(int, input().split())
PY = [list(map(int, input().split())) for _ in range(M)]

PY_list = defaultdict(list)
for i in range(len(PY)):
    PY_list[PY[i][0]].append([i, PY[i][1]])
#print(PY_list)

py_opt = dict()
for pyl in PY_list.values():
    pyl.sort(key = lambda x: x[1])
    for i in range(len(pyl)):
        #print(i)
        py_opt[pyl[i][0]] = i

#print(py_opt)
#print(PY_list)
for i in range(len(PY)):
    #n = PY_list[PY[i][0]].index([i, PY[i][1]])
    n = py_opt[i]
    print("{:06d}{:06d}".format(PY[i][0], n + 1))

Submission Info

Submission Time
Task C - ID
User showyou41
Language Python3 (3.4.3)
Score 300
Code Size 592 Byte
Status
Exec Time 876 ms
Memory 64500 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 300 / 300 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, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt 818 ms 54408 KB
02.txt 699 ms 46948 KB
03.txt 20 ms 3316 KB
04.txt 20 ms 3316 KB
05.txt 704 ms 51464 KB
06.txt 876 ms 64500 KB
07.txt 27 ms 3956 KB
08.txt 728 ms 48384 KB
09.txt 806 ms 54284 KB
10.txt 714 ms 50740 KB
11.txt 656 ms 45576 KB
12.txt 440 ms 31404 KB
13.txt 674 ms 45816 KB
14.txt 820 ms 54412 KB
15.txt 811 ms 54400 KB
16.txt 802 ms 54428 KB
17.txt 819 ms 54288 KB
18.txt 821 ms 54416 KB
sample_01.txt 21 ms 3316 KB
sample_02.txt 21 ms 3316 KB
sample_03.txt 20 ms 3316 KB