problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
|---|---|---|---|---|---|---|---|---|---|---|
p03221
|
u036744414
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['# coding:utf-8\n\ndef gen_id(n):\n id = ""\n hokan = 6 - len(str(n))\n for _ in range(hokan):\n id += "0"\n id += str(n)\n return id\n\nN, M = map(int, input().split())\n\nDIC = dict()\nNUM_DIC = dict()\nfor pi in range(1, N+1):\n DIC[pi] = []\n NUM_DIC[pi] = 0\n\nfor _ in range(M):\n pi, yi = map(int, input().split())\n DIC[pi].append(yi)\n NUM_DIC[pi] += 1\n\n\nfor pi in range(1, N+1):\n DIC[pi].sort(reverse=True)\n\ncounter = 1\nwhile True:\n flg = False\n for pi in range(1, N+1):\n if NUM_DIC[pi] >= counter:\n flg = True\n DIC[pi]\n id = gen_id(pi) + gen_id(counter)\n print(id)\n counter += 1\n if flg != True:\n break\n\n', '# coding:utf-8\n\nN, M = map(int, input().split())\n\ndef gen_id(n):\n id = ""\n hokan = 6 - len(str(n))\n for _ in range(hokan):\n id += "0"\n id += str(n)\n return id\n\nDIC = dict()\nCITY = []\n\nfor pi in range(1, N+1):\n DIC[pi] = []\n\nfor i in range(M):\n pi, yi = map(int, input().split())\n DIC[pi].append({ "i":i, "p":pi, "y":yi})\n\n\nfor pi in range(1, N+1):\n DIC[pi] = sorted(DIC[pi], key=lambda x: x["y"])\n\n\nfor pi in range(1, N+1):\n for index, city in enumerate(DIC[pi]):\n id = gen_id(city["p"]) + gen_id(index+1)\n city["id"] = id\n CITY.append(city)\n\n\nx =sorted(CITY, key=lambda x: x["i"])\n\nfor i in x:\n print(i["id"])\n\n']
|
['Wrong Answer', 'Accepted']
|
['s358562804', 's127868398']
|
[33972.0, 73356.0]
|
[2105.0, 1283.0]
|
[703, 757]
|
p03221
|
u038408819
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map(int, input().split())\n\n \npy = [list(map(int, input().split())) for i in range(M)]\npy.sort()\ncnt = 1\npre = py[0][0]\nans = '0' * (6 - len(str(py[0][0]))) + str(py[0][0]) + '0' * 5 + '1'\ncnt += 1\nprint(ans)\nfor i in range(1, M):\n \n if py[i][0] != pre:\n cnt = 1\n pre = py[i][0]\n ans = '0' * (6 - len(str(py[i][0]))) + str(py[i][0])\n ans += '0' * (6 - len(str(cnt))) + str(cnt)\n cnt += 1\n print(ans)", "N, M = map(int, input().split())\npy = []\nd = {}\nfor i in range(M):\n p, y = map(int, input().split())\n py.append([p, y])\n if p not in d:\n d[p] = [y]\n else:\n d[p].append(y)\nfor key in d.keys():\n d[key].sort()\nfrom bisect import bisect_left\nfor i in range(M):\n p, y = py[i]\n a = bisect_left(d[p], y)\n ans = '0' * (6 - len(str(p))) + str(p)\n ans += '0' * (6 - len(str(a + 1))) + str(a + 1)\n print(ans)"]
|
['Wrong Answer', 'Accepted']
|
['s712318151', 's614280110']
|
[28824.0, 36636.0]
|
[756.0, 757.0]
|
[497, 441]
|
p03221
|
u044459372
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\nli=[[] for i in range(n+1)]\n\nfor i in range(m):\n\tj,k=map(int,input().split())\n\tli[j].append(k)\n\nfor i in range(1,m):\n\tli[i].sort()\n\tfor j in li[i]:\n\t\tprint(str(i).zfill(6)+str(j).zfill(6))', "def main():\n n, m = map(int, input().split())\n p, y = [0 for i in range(m)], [0 for i in range(m)]\n for i in range(m):\n p[i], y[i] = map(int, input().split())\n ans = solve(n, m, p, y)\n\n\ndef solve(n, m, p, y):\n kens = [[] for i in range(n + 1)]\n for i in range(m):\n kens[p[i]].append(y[i])\n for ken in kens:\n ken.sort()\n \n \n ids = [{} for i in range(n + 1)]\n for indken, ken in enumerate(kens):\n for indsi, yi in enumerate(ken, 1):\n ids[indken][yi] = str(indken).zfill(6) + str(indsi).zfill(6)\n \n \n for i in range(m):\n print(ids[p[i]][y[i]])\n\n return\n\nif __name__ == '__main__':\n main()"]
|
['Runtime Error', 'Accepted']
|
['s150475765', 's224359695']
|
[19632.0, 64220.0]
|
[531.0, 607.0]
|
[217, 696]
|
p03221
|
u046187684
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['import numpy as np\n\n\ndef solve(string):\n n, m, *py = map(int, string.split())\n p = [[] for _ in range(n)]\n for _p, _y in py:\n p[_p - 1].append(_y)\n for i in range(n):\n p[i] = np.argsort(np.argsort(p[i]))\n counter = [0 for _ in range(n)]\n for _p, _y in py:\n t = "{:06}{:06}".format(_p, p[_p - 1][counter[_p - 1]] + 1)\n print(t)\n counter[_p - 1] += 1\n p[i] = np.argsort(np.argsort(p[i]))\n\n\nif __name__ == \'__main__\':\n n, m = map(int, input().split())\n\n print(solve("{} {}\\n".format(n, m) + "\\n".join([input() for _ in range(m)])))\n', 'import numpy as np\n\n\nn, m = map(int, input().split())\npy = [list(map(int, input().split())) for _ in range(m)]\np = [[] for _ in range(n)]\nstart = time.time()\nfor _p, _y in py:\n p[_p - 1].append(_y)\nfor i in range(n):\n p[i] = np.argsort(np.argsort(p[i]))\n\ncounter = [0 for _ in range(n)]\nfor _p, _y in py:\n t = "{:06}{:06}".format(_p, p[_p - 1][counter[_p - 1]] + 1)\n print(t)\n counter[_p - 1] += 1\n', 'import numpy as np\n\n\ndef solve(string):\n\n n, m, *py = map(int, string.split())\n py = [(_p, _y) for _p, _y in zip(py[0::2], py[1::2])]\n p = [[] for _ in range(n)]\n for _p, _y in py:\n p[_p - 1].append(_y)\n for i in range(n):\n p[i] = np.argsort(np.argsort(p[i]))\n\n counter = [0 for _ in range(n)]\n ans = []\n for _p, _y in py:\n ans.append("{:06}{:06}".format(_p, p[_p - 1][counter[_p - 1]] + 1))\n counter[_p - 1] += 1\n return "\\n".join(ans)\n\n\nif __name__ == \'__main__\':\n n, m = map(int, input().split())\n print(solve("{} {}\\n".format(n, m) + "\\n".join([input() for _ in range(m)])))\n']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s395707764', 's992437771', 's905634871']
|
[36240.0, 43796.0, 55336.0]
|
[340.0, 503.0, 1631.0]
|
[595, 413, 640]
|
p03221
|
u048004795
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["# -*-coding: utf-8 -*-\n\nimport sys\n\ndef main():\n input = sys.stdin.readline\n n, m = map(int, input().split())\n y_dict = {}\n ken_dict = {}\n for i in range(m):\n p_i, y_i = map(int, input().split())\n y_dict[y_i] = []\n y_dict[y_i].append(p_i)\n\n if not p_i in ken_dict:\n ken_dict[p_i] = []\n ken_dict[p_i].append(y_i)\n else:\n ken_dict[p_i].append(y_i)\n\n\n for key in ken_dict.keys():\n ken_dict[key].sort()\n print(ken_dict[key])\n for i,value in enumerate(ken_dict[key]):\n i += 1\n y_dict[value].append(i)\n \n for value in y_dict.values():\n print(str(value[0]).rjust(6, '0') + str(value[1]).rjust(6, '0'))\n \n return\n\n\nif __name__ == '__main__':\n main()", "# -*-coding: utf-8 -*-\n\nimport sys\n\ndef main():\n input = sys.stdin.readline\n n, m = map(int, input().split())\n y_dict = {}\n ken_dict = {}\n for i in range(m):\n p_i, y_i = map(int, input().split())\n y_dict[y_i] = []\n y_dict[y_i].append(p_i)\n\n if not p_i in ken_dict:\n ken_dict[p_i] = []\n ken_dict[p_i].append(y_i)\n else:\n ken_dict[p_i].append(y_i)\n\n\n for key in ken_dict.keys():\n ken_dict[key].sort()\n for i,value in enumerate(ken_dict[key]):\n i += 1\n y_dict[value].append(i)\n \n for value in y_dict.values():\n print(str(value[0]).rjust(6, '0') + str(value[1]).rjust(6, '0'))\n \n return", "# -*-coding: utf-8 -*-\n\nimport sys\n\ndef main():\n input = sys.stdin.readline\n n, m = map(int, input().split())\n y_dict = {}\n ken_dict = {}\n for i in range(m):\n p_i, y_i = map(int, input().split())\n y_dict[y_i] = []\n y_dict[y_i].append(p_i)\n\n if not p_i in ken_dict:\n ken_dict[p_i] = []\n ken_dict[p_i].append(y_i)\n else:\n ken_dict[p_i].append(y_i)\n\n\n for key in ken_dict.keys():\n ken_dict[key].sort()\n for i,value in enumerate(ken_dict[key]):\n i += 1\n y_dict[value].append(i)\n \n for value in y_dict.values():\n print(str(value[0]).zfill(6) + str(value[1]).zfill(6))\n \n return\n\n\nif __name__ == '__main__':\n main()"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s218458706', 's589131360', 's887890474']
|
[44584.0, 9092.0, 44372.0]
|
[331.0, 31.0, 290.0]
|
[792, 723, 753]
|
p03221
|
u054514819
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map(int, input().split())\nfrom bisect import bisect_right\ndic = [[] for i in range(N)]\n\nshi = {}\nfor i in range(M):\n p, y = map(int, input().split())\n dic[p-1].append(y)\n shi[i] = (p, y)\n\nfor j in range(M):\n p, y = shi[j]\n print('{:06}{:06}'.format(p, bisect_right(dic[p-1], y)))\n\n", "N, M = map(int, input().split())\nfrom bisect import bisect_right\ndic = [[] for i in range(N)]\n\nshi = {}\nfor i in range(M):\n p, y = map(int, input().split())\n dic[p-1].append(y)\n shi[i] = (p, y)\n\nfor i in range(N):\n dic[i].sort()\n\nfor j in range(M):\n p, y = shi[j]\n print('{:06}{:06}'.format(p, bisect_right(dic[p-1], y)))\n\n"]
|
['Wrong Answer', 'Accepted']
|
['s969599886', 's175265727']
|
[38188.0, 38212.0]
|
[638.0, 688.0]
|
[303, 341]
|
p03221
|
u057109575
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map(int, input().split())\nX = [list(map(int, input().split())) for _ in range(M)]\nX.sort()\n\ncity = X[0][0]\nnum = 0\nfor v in X:\n if city == v[0]:\n num += 1\n else:\n city = v[0]\n num = 1\n print('{:06}{:06}'.format(v[0], num))", "N, M = map(int, input().split())\nX = [list(map(int, input().split())) for _ in range(M)]\nans = [''] * M\nnum = [1] * N\n\nfor i, v in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):\n ans[i] = '{:06}{:06}'.format(v[0], num[v[0] - 1])\n num[v[0] - 1] += 1\n \nprint('\\n'.join(ans))"]
|
['Wrong Answer', 'Accepted']
|
['s273978939', 's634975269']
|
[30052.0, 47328.0]
|
[662.0, 624.0]
|
[259, 290]
|
p03221
|
u063052907
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(M)]\nlst_city = [[] for _ in range(N)]\n\nfor i, y in lst:\n i -= 1\n lst_city[i].append(y)\nelse:\n lst_city[i].sort()\nprint(lst_city)\n\n\nfor i, y in lst:\n id_u = str(i).zfill(6)\n id_l = str(lst_city[i-1].index(y) + 1).zfill(6)\n ans = id_u + id_l\n print(ans)\n', 'N, M = map(int, input().split())\nsrc = [list(map(int, input().split())) for _ in range(M)]\n\n\nlst_city = [[] for _ in range(N+1)]\nfor i, (p, y) in enumerate(src):\n lst_city[p].append((y, i))\n\n\nans = [None] * M\nfor pi, cities in enumerate(lst_city):\n for order, (y, i) in enumerate(sorted(cities)):\n ans[i] = str(pi).zfill(6) + str(order + 1).zfill(6)\nprint(*ans, sep="\\n")']
|
['Wrong Answer', 'Accepted']
|
['s031277547', 's862839211']
|
[40136.0, 55316.0]
|
[2106.0, 701.0]
|
[360, 384]
|
p03221
|
u065079240
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\ncity = [0]*M\nfor i in range(M):\n city[i] = [i] * 4\n prefecture, year = map(int, input().split())\n city[i][0], city[i][1] = year, prefecture\n\ncity = sorted(city)\nprint(city)\n\nprint(city)\nite = [1] * (N+1)\nfor k in range(M):\n city[k][3] = ite[city[k][1]]\n ite[city[k][1]] += 1\ncity = sorted(city, key=lambda x: x[2])\nfor j in range(M):\n print("{:0=12}".format(city[j][1]*1000000+city[j][3])) \n', 'N, M = map(int, input().split())\ncity = [0]*M\nfor i in range(M):\n city[i] = [i] * 4\n prefecture, year = map(int, input().split())\n city[i][0], city[i][1] = year, prefecture\n\ncity = sorted(city)\n\nite = [1] * (N+1)\nfor k in range(M):\n city[k][3] = ite[city[k][1]]\n ite[city[k][1]] += 1\ncity = sorted(city, key=lambda x: x[2])\nfor j in range(M):\n print("{:0=12}".format(city[j][1]*1000000+city[j][3])) \n']
|
['Wrong Answer', 'Accepted']
|
['s134909290', 's316476368']
|
[41260.0, 30632.0]
|
[963.0, 843.0]
|
[457, 433]
|
p03221
|
u067983636
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['import heapq\n\nN, M = map(int, input().split())\nS = ["" for m in range(M)]\n\nD = {}\nfor m in range(M):\n P, Y = map(int, input().split())\n listP = D.setdefault(P, [])\n heapq.heappush(listP, (Y, m))\n\nprint(D)\n\nfor p, l in D.items():\n for i in range(len(l)):\n y, m = heapq.heappop(l)\n S[m] = format(p, "06") + format(i + 1, "06")\n\nfor s in S:\n print(s)\n', 'import heapq\n\nN, M = map(int, input().split())\nS = ["" for m in range(M)]\n\nD = {}\nfor m in range(M):\n P, Y = map(int, input().split())\n listP = D.setdefault(P, [])\n heapq.heappush(listP, (Y, m))\n\nfor p, l in D.items():\n for i in range(len(l)):\n y, m = heapq.heappop(l)\n S[m] = format(p, "06") + format(i + 1, "06")\n\nfor s in S:\n print(s)\n']
|
['Wrong Answer', 'Accepted']
|
['s821654179', 's394644907']
|
[45196.0, 38288.0]
|
[779.0, 685.0]
|
[377, 367]
|
p03221
|
u074294821
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["from collections import defaultdict\nimport bisect\n\npre = defaultdict(list)\nori = []\nn, m = map(int, input().split())\nfor _ in range(m):\n x, y = map(int, input().split())\n pre[x].append(y)\n ori.append([x, y])\n\nfor key, val in pre.items():\n val.sort()\n\nprint(pre)\nfor i in range(m):\n l = pre[ori[i][0]]\n idx = bisect.bisect(l, ori[i][1])\n print(f'{ori[i][0]:06}{idx:06}')\n\n", "from collections import defaultdict\nimport bisect\n\npre = defaultdict(list)\nori = []\nn, m = map(int, input().split())\nfor _ in range(m):\n x, y = map(int, input().split())\n pre[x].append(y)\n ori.append([x, y])\n\nfor key, val in pre.items():\n val.sort()\n\nfor i in range(m):\n l = pre[ori[i][0]]\n idx = bisect.bisect(l, ori[i][1])\n print(f'{ori[i][0]:06}{idx:06}')\n\n"]
|
['Wrong Answer', 'Accepted']
|
['s342345925', 's433206458']
|
[42604.0, 38708.0]
|
[431.0, 432.0]
|
[392, 381]
|
p03221
|
u077291787
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['import sys\ninput = sys.stdin.readline\n\nn, m = list(map(int, input().rstrip().split()))\nans = [""] * m\narr = []\ncnt = 1\nfor i in range(m):\n p, y = map(int, input().split())\n arr += [(p, y, i)]\narr = sorted(arr)\n\nans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)\nfor i in range(1, m):\n if arr[i - 1][0] == arr[i][0]:\n cnt += 1\n else:\n cnt = 1\n ans[arr[i][2]] = "{:06}{:06}".format(arr[i][0], cnt)\n\nfor i in asn:\n print(i)\nprint(*ans, sep="\\n")', '## ABC113C - ID\nimport sys\ninput = sys.stdin.readline\n\nn, m = list(map(int, input().rstrip().split()))\narr = [list(map(int, input().rstrip().split())) for _ in range(m)]\npref = [[] for _ in range(n)]\nfor i in arr:\n pref[i[0] - 1] += [i]\nprint(pref)\npref = [sorted(i) for i in pref]\nprint(pref)\nfor i in arr:\n j = pref[i[0] - 1].index(i) + 1\n print("{:0>6}{:0>6}".format(i[0], j))', 'import sys\ninput = sys.stdin.readline\n\nn, m = list(map(int, input().rstrip().split()))\nans = [""] * m\narr = []\ncnt = 1\nfor i in range(m):\n p, y = map(int, input().split())\n arr += [(p, y, i)]\narr = sorted(arr)\n\nans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)\nfor i in range(1, m):\n if arr[i - 1][0] == arr[i][0]:\n cnt += 1\n else:\n cnt = 1\n ans[arr[i][2]] = "{:06}{:06}".format(arr[i][0], cnt)\n\nfor i in asn:\n print(i)', '## ABC113C - ID\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n n, m = list(map(int, input().rstrip().split()))\n ans = [""] * m\n arr = []\n cnt = 1\n for i in range(m):\n p, y = list(map(int, input().split()))\n arr += [(p, y, i)]\n arr = sorted(arr)\n\n ans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)\n for i in range(1, m):\n if arr[i - 1][0] == arr[i][0]:\n cnt += 1\n else:\n cnt = 1\n ans[arr[i][2]] = "{:06}{:06}".format(arr[i][0], cnt)\n\n for i in ans:\n print(i)\n print(ans)\n\n\nif __name__ == "__main__":\n main()', '# ABC113C - ID\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n N, M = tuple(map(int, input().split()))\n P = [[] for _ in range(N + 1)] \n for num in range(M): # classify cities by prefectures\n pref, year = tuple(map(int, input().split()))\n P[pref] += [(year, num)]\n ans = [""] * M\n P = tuple(sorted(p) for p in P) # sort by year\n for pref_idx, pref in enumerate(P):\n for city_idx, (_, num) in enumerate(pref, 1):\n x = "{:06}{:06}".format(pref_idx, city_idx)\n ans[num] = x\n print(*ans, sep="\\n")\n print(type(P))\n\nif __name__ == "__main__":\n main()', '# ABC113C - ID\ndef main():\n N, M, *PY = map(int, open(0).read().split())\n P = [[] for _ in range(N + 1)] \n # classify cities by prefectures\n for num, (pref, year) in enumerate(zip(*[iter(PY)] * 2)):\n P[pref] += [(year, num)]\n ans = [[] for _ in range(M)]\n P = [sorted(p) for p in P] # sort by year\n for pref_idx, pref in enumerate(P):\n for city_idx, (_, num) in enumerate(pref, 1):\n x = "{:06}{:06}".format(pref_idx, city_idx)\n ans[num] = x\n print("\\n".join(map(str, ans)))\n\n \nif __name__ == "__main__":\n main()']
|
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s386809603', 's415307756', 's445281994', 's726432939', 's995833897', 's656547066']
|
[27640.0, 50208.0, 27644.0, 34548.0, 40460.0, 51420.0]
|
[428.0, 2106.0, 427.0, 485.0, 503.0, 460.0]
|
[476, 388, 454, 611, 635, 592]
|
p03221
|
u079022693
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['from sys import stdin\ndef f(n,m):\n n,m=str(n),str(m)\n s1=["0"]*(6-len(n))\n s1.append(n)\n s2=["0"]*(6-len(m))\n s2.append(m)\n return "".join(s1)+"".join(s2)\n\ndef main():\n \n readline=stdin.readline\n N,M=map(int,readline().split())\n li=[0]*M\n for i in range(M):\n a=list(map(int,readline().split()))\n a.append(i)\n li[i]=a\n \n li.sort(key=lambda x:x[1])\n print(li)\n count=[1]*(N+1)\n for i in range(M):\n city_number=li[i][0]\n x=count[city_number]\n count[city_number]+=1\n li[i].append(f(city_number,x))\n\n li.sort(key=lambda x:x[2])\n for i in range(M):\n print(li[i][3])\n \nif __name__=="__main__":\n main()', 'from sys import stdin\ndef f(n,m):\n n,m=str(n),str(m)\n s1=["0"]*(6-len(n))\n s1.append(n)\n s2=["0"]*(6-len(m))\n s2.append(m)\n return "".join(s1)+"".join(s2)\n\ndef main():\n \n readline=stdin.readline\n N,M=map(int,readline().split())\n li=[0]*M\n for i in range(M):\n a=list(map(int,readline().split()))\n a.append(i)\n li[i]=a\n \n li.sort(key=lambda x:x[1])\n count=[1]*(N+1)\n for i in range(M):\n city_number=li[i][0]\n x=count[city_number]\n count[city_number]+=1\n li[i].append(f(city_number,x))\n\n li.sort(key=lambda x:x[2])\n for i in range(M):\n print(li[i][3])\n \nif __name__=="__main__":\n main()']
|
['Wrong Answer', 'Accepted']
|
['s778138220', 's890387943']
|
[43236.0, 39264.0]
|
[783.0, 634.0]
|
[721, 707]
|
p03221
|
u083960235
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N,M=map(int,input().split())\nL=[list(map(int,input().split())) for i in range(M)]\nL.sort(key=lambda x:x[1])\nL.sort(key=lambda x:x[0])\ncity_num=1#\n#12 to 1\n#32 to 2\ninside_num=1\nfor i in range(M):\n if L[i][0]==city_num:\n L[i][1]=inside_num\n inside_num+=1\n else:\n city_num+=1\n inside_num=1\n L[i][1]=inside_num\n inside_num+=1\n#print(L)\nfor l in L:\n print("{:0=6}{:0=6}".format(l[0],l[1]))#0 padding\n', 'N,M=map(int,input().split())\nL=[list(map(int,input().split())) for i in range(M)]\nfor i in range(M):\n L[i].append(i)\nL.sort(key=lambda x:x[1])\nL.sort(key=lambda x:x[0])\ncity_num=1#\n#12 to 1\n#32 to 2\ninside_num=1\nfor i in range(M):\n while L[i][0]!=city_num:\n city_num+=1\n inside_num=1\n L[i][1]=inside_num\n inside_num+=1\n#print(L)\nL.sort(key=lambda x:x[2])\nfor l in L:\n print("{:0=6}{:0=6}".format(l[0],l[1]))#0 padding\n']
|
['Wrong Answer', 'Accepted']
|
['s683804912', 's669594953']
|
[29400.0, 32280.0]
|
[699.0, 822.0]
|
[447, 447]
|
p03221
|
u088553842
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["def main():\n n, m = map(int, input().split())\n def zs(num):\n k = 6 - len(str(num))\n return '0' * k + str(num)\n lst = [[-1] for i in range(n + 1)]\n cities = []\n for i in range(m):\n temp = tuple(map(int, input().split()))\n lst[temp[0]].append(temp[1])\n cities.append(temp)\n for l in lst:\n l.sort()\n print(lst)\n for tpl in cities:\n a = lst[tpl[0]].index(tpl[1])\n print(zs(tpl[0]) + zs(a))\nif __name__ == '__main__':\n main()", "n, m = map(int, input().split())\ndef zs(num):\n k = 6 - len(str(num))\n return '0' * k + str(num)\nlst = []\nfor i in range(m):\n lst.append(tuple(map(int, input().split())))\nslst = sorted(lst)\ndic = {}\ntemp = 0\nfor i in range(m):\n if slst[i][0] == slst[i - 1][0]:\n temp += 1\n else:\n temp = 1\n dic[slst[i]] = zs(slst[i][0]) + zs(temp)\nfor i in lst:\n print(dic[i])"]
|
['Wrong Answer', 'Accepted']
|
['s703067908', 's929873971']
|
[38816.0, 36812.0]
|
[2207.0, 528.0]
|
[453, 375]
|
p03221
|
u089376182
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int, input().split())\ninfo = [[i] + list(map(int, input().split())) for i in range(1, m+1)]\ncity = sorted(set([info_i[0] for info_i in info]))\n\n', 'n,m = map(int, input().split())\ninfo = [[i] + list(map(int, input().split())) for i in range(1, m+1)]\ncity = sorted(set([info_i[0] for info_i in info]))\n\nsorted_info = sorted(info, key=lambda x:x[1])\n\nprint(sorted_info)\n\ncounter = 0\n\np = city.pop(0)\n\nfor i in range(m):\n if sorted_info[i][1] == p:\n counter += 1\n sorted_info[i].append(counter)\n else:\n p = city.pop(0)\n counter = 1\n sorted_info[i].append(counter)\n\nresult = sorted(sorted_info, key=lambda x:x[0])\n\nfor res_i in result:\n print(str(res_i[1]).zfill(6) + str(res_i[3]).zfill(6))\n', "from collections import defaultdict\nfrom bisect import bisect\n\nn,m = map(int, input().split())\np = [list(map(int, input().split())) for _ in range(m)]\n\na = defaultdict(list)\n\nfor p_i in sorted(p):\n a[p_i[0]].append(p_i[1])\n \nfor p_i in p:\n x = p_i[0]\n y = bisect(a[x], p_i[1])\n \n print(str(x).zfill(6), str(y).zfill(6), sep='')"]
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s376622525', 's712572983', 's179502821']
|
[30284.0, 35592.0, 43328.0]
|
[389.0, 2105.0, 803.0]
|
[554, 559, 333]
|
p03221
|
u094191970
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\n\nans=[[] for i in range(m)]\np_list=[[] for i in range(n)]\n\nfor i in range(m):\n p,y=map(int,input().split())\n\n ans[i]=str(p).zfill(6)\n p_list[p].append([i,y])\n\nfor pp in p_list:\n pp=sorted(pp,key=lambda x:x[1])\n num=0\n for ppp in pp:\n num+=1\n ans[ppp[0]]+=str(num).zfill(6)\n num=0\n\nfor i in ans:\n print(i)', 'from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\nlnii=lambda:list(map(int,stdin.readline()).split())\n\nn,m=nii()\n\nlist=[[] for i in range(n+1)]\n\nfor i in range(m):\n p,y=nii()\n list[p].append([y,i])\n\nans=[]\nfor i in range(1,n+1):\n tl=list[i]\n s_tl=sorted(tl,key=lambda x:x[0])\n for j in range(len(tl)):\n town=s_tl[j][1]\n s1=str(i).zfill(6)\n s2=str(j+1).zfill(6)\n s=s1+s2\n ans.append([town,s])\n\nans.sort(key=lambda x:x[0])\nfor i,j in ans:\n print(j)']
|
['Runtime Error', 'Accepted']
|
['s571741029', 's860221956']
|
[42536.0, 49984.0]
|
[804.0, 671.0]
|
[335, 484]
|
p03221
|
u099566485
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\np=[[] for i in range(n)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(n):\n tl=p[i].sort()\n for j in range(len(p[i])):\n u=str(i+1)\n w=tl.index(p[i][j])\n d=str(w+1)\n while len(u)<6:\n u="0"+u\n while len(d)<6:\n d="0"+d\n t=u+d\n nl.append(t)\nfor i in range(m):\n print(nl[i])', 'n,m=map(int,input().split())\np=[[] for i in range(n)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(n):\n tl=sorted(p[i])\n for j in p[i]:\n u=str(i+1)\n d=str(tl.index(j)+1)\n u="0"*(6-len(u))+u\n d="0"*(6-len(d))+d\n print(u+d)', 'n,m=map(int,input().split())\np=[[] for i in range(n)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(n):\n for j in range(len(p[i])):\n u=str(i+1)\n d=str(j+1)\n while len(u)<6:\n u="0"+u\n while len(d)<6:\n d="0"+d\n t=u+d\n nl.append(t)\nfor i in range(m):\n print(nl[i])', 'n,m=map(int,input().split())\np=[[] for i in range(m)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(m):\n for j in range(len(p[i])):\n u=str(i+1)\n d=str(j+1)\n while len(u)<6:\n u="0"+u\n while len(d)<6:\n d="0"+d\n t=u+d\n nl.append(t)\nfor i in range(m):\n print(nl[i])', 'n,m=map(int,input().split())\np=[[] for i in range(n)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(n):\n tl=sorted(p[i])\n for j in p[i]:\n u=str(i+1)\n w=tl.index(j)\n d=str(w+1)\n while len(u)<6:\n u="0"+u\n while len(d)<6:\n d="0"+d\n t=u+d\n nl.append(t)\nfor i in range(m):\n print(nl[i])', 'n,m=map(int,input().split())\np=[[] for i in range(n)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(n):\n tl=sorted(p[i])\n for j in p[i]:\n u=str(i+1)\n w=tl.index(j)\n d=str(w+1)\n while len(u)<6:\n u="0"+u\n while len(d)<6:\n d="0"+d\n t=u+d\n nl.append(t)\nfor i in range(m):\n print(nl[i])', 'n,m=map(int,input().split())\np=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p.append([i,t1,t2])\np.sort(key=lambda x:x[2])\nc=[1 for i in range(n+1)]\nnum=[]\nfor i,pre,yea in p:\n tmp=str(pre).zfill(6)+str(c[pre]).zfill(6)\n num.append([i,tmp])\n c[pre]+=1\nnum.sort()\nfor i in num:\n print(i[1])']
|
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s304666226', 's324728161', 's777642196', 's914789146', 's937607543', 's975072100', 's229278166']
|
[17968.0, 19352.0, 26520.0, 26836.0, 26516.0, 26408.0, 42740.0]
|
[396.0, 2104.0, 656.0, 721.0, 2104.0, 2104.0, 934.0]
|
[435, 320, 388, 388, 418, 418, 316]
|
p03221
|
u102126195
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['def ABC113C():\n \n N, M = map(int, input().split())\n PY = [list(map(int, input().split())) for i in range(M)]\n P = [[] for i in range(10 ** 5)]\n\n from operator import itemgetter\n PY.sort(key = itemgetter(1))\n for k in range(len(PY)):\n i = PY[k][0]\n j = PY[k][1]\n P[i - 1].append([j, k])\n anslist = []\n for i in range(len(P)):\n for j in range(len(P[i])):\n anslist.append([i + 1, j + 1, P[i][j][1] + 1])\n anslist.sort(key = itemgetter(2))\n for i, j, k in anslist:\n i = str(i)\n j = str(j)\n while len(i) != 6:\n i = "0" + i\n while len(j) != 6:\n j = "0" + j\n print(i + j)\nABC113C()', '\ndef ABC113C():\n\n N, M = map(int, input().split())\n PY = [list(map(int, input().split())) for i in range(M)]\n P = [[] for i in range(10 ** 5)]\n\n from operator import itemgetter\n #PY.sort(key = itemgetter(1))\n for k in range(len(PY)):\n i = PY[k][0]\n j = PY[k][1]\n P[i - 1].append([j, k])\n\n for i in range(len(P)):\n P[i].sort()\n\n anslist = []\n for i in range(len(P)):\n for j in range(len(P[i])):\n anslist.append([i + 1, j + 1, P[i][j][1] + 1])\n anslist.sort(key = itemgetter(2))\n for i, j, k in anslist:\n i = str(i)\n j = str(j)\n while len(i) != 6:\n i = "0" + i\n while len(j) != 6:\n j = "0" + j\n print(i + j)\nABC113C()']
|
['Wrong Answer', 'Accepted']
|
['s142512330', 's371910642']
|
[65696.0, 64836.0]
|
[998.0, 996.0]
|
[703, 751]
|
p03221
|
u102960641
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int, input().split())\na = [list(map(int, input().split())) for i in range(m)]\nc = [0]*n\nfor i in a:\n p,y = i[0],i[1]\n c[p-1] += 1\n num = c[p-1]\n print("0"*(6-len(p))+"0"*(6-len(num))+num)\n ', 'import math\nn,m = map(int, input().split())\na = []\nfor i in range(m):\n pk,yk = map(int,input().split())\n b = [pk,yk,i]\n a.append(b)\na.sort(key=lambda x:(x[0],x[1]))\nb = a[0][0]\nc = 0\nfor i in range(len(a)):\n if a[i][0] != b:\n b = a[i][0]\n c = 1\n else:\n c += 1\n a[i].append(c)\na.sort(key=lambda x:x[2])\nfor i in range(len(a)):\n a[i].append(math.floor(math.log10(a[i][0])+1.0))\n a[i].append(math.floor(math.log10(a[i][3])+1.0))\n print(str("0"*(6-a[i][4]))+str(a[i][0])+str("0"*(6-a[i][5]))+str(a[i][3]))\n\n \n\n']
|
['Runtime Error', 'Accepted']
|
['s378293379', 's887356580']
|
[28172.0, 41748.0]
|
[339.0, 949.0]
|
[204, 525]
|
p03221
|
u106797249
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['def resolve():\n (N, M) = list(map(int,input().split(" ")))\n cities = [list(map(int, input().split(" "))) + [i] for i in range(M)]\n sorted_cities = sorted(cities, key=lambda x: (x[0], x[1]))\n\n pref = 0\n cnt = 0\n for city in sorted_cities:\n if pref != city[0]:\n pref = city[0]\n cnt = 0\n cnt = cnt + 1\n city.append("{:06d}{:06d}".format(pref, cnt))\n \n \n for city in sorted_cities:\n print(city[3])\n\nif \'__main__\' == __name__:\n resolve()', 'def resolve():\n (N, M) = list(map(int,input().split(" ")))\n cities = [list(map(int, input().split(" "))) + [i] for i in range(M)]\n sorted_cities = sorted(cities, key=lambda x: (x[0], x[1]))\n\n pref = 0\n cnt = 0\n for city in sorted_cities:\n if pref != city[0]:\n pref = city[0]\n cnt = 0\n cnt = cnt + 1\n city.append("{:06d}{:06d}".format(pref, cnt))\n \n \n # for city in sorted_cities:\n # print(city[3])\n\n for city in cities:\n print(city[3])\n\nif \'__main__\' == __name__:\n resolve()']
|
['Wrong Answer', 'Accepted']
|
['s417960879', 's873817263']
|
[35368.0, 35428.0]
|
[672.0, 661.0]
|
[563, 615]
|
p03221
|
u108990937
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = (int(i) for i in input().split(' '))\npy=[]\np =[]\n\nfor i in range(M):\n p = [i]\n p.extend([int(j) for j in input().split(' ')])\n py.append(p)\n\nNpy = []\nfor i in range(1,N+1):\n \n pyi = [j for j in py if j[1] == i] \n pyi.sort(key=lambda x: x[2]) \n l = len(pyi)\n cnt = 0\n for k in range(1,l+1):\n pyi[k-1][2] = k\n Npy.extend(pyi)\n\nNpy.sort(key=lambda x: x[0])\nprint(Npy)\n\nfor t in Npy:\n print('{0:0>6}{1:0>6}'.format(t[1],t[2]))\n ", "from operator import itemgetter\nN, M = (int(i) for i in input().split(' '))\npy=[]\np =[]\n\n\nfor i in range(M):\n p = [i]\n p.extend([int(j) for j in input().split(' ')])\n py.append(p)\n\n\nNpy = []\nfor i in range(1,N+1):\n \n pyi = [j for j in py if j[1] == i] の市リスト\n pyi.sort(key=itemgetter(2)) の市を生まれた年でソート\n l = len(pyi)\n cnt = 0\n for k in range(1,l+1):\n pyi[k-1][2] = k\n Npy.extend(pyi)\n\nNpy.sort(key=itemgetter(0))\n\nfor t in Npy:\n print('{0:0>6}{1:0>6}'.format(t[1],t[2]))\n ", "N, M = (int(i) for i in input().split(' '))\npy=[]\np =[]\n\n\nfor i in range(M):\n p = [i]\n p.extend([int(j) for j in input().split(' ')])\n py.append(p)\n\n\nNpy = []\nfor i in range(1,N+1):\n \n pyi = [j for j in py if j[1] == i] の市リスト\n pyi.sort(key=lambda x: x[2]) の市を生まれた年でソート\n l = len(pyi)\n cnt = 0\n for k in range(1,l+1):\n pyi[k-1][2] = k\n Npy.extend(pyi)\n\nNpy.sort(key=lambda x: x[0])\n\nfor t in Npy:\n print('{0:0>8}{1:0>8'.format(t[1],t[2]))\n ", "N, M = (int(i) for i in input().split(' '))\npy=[]\np =[]\n\n\nfor i in range(M):\n p = [i]\n p.extend([int(j) for j in input().split(' ')])\n py.append(p)\n\n\nNpy = []\nfor i in range(1,N+1):\n \n pyi = [j for j in py if j[1] == i] の市リスト\n pyi.sort(key=lambda x: x[2]) の市を生まれた年でソート\n l = len(pyi)\n cnt = 0\n for k in range(1,l+1):\n pyi[k-1][2] = k\n Npy.extend(pyi)\n\nNpy.sort(key=lambda x: x[0])\n\nfor t in Npy:\n print('{0:0>6}{1:0>6}'.format(t[1],t[2]))\n ", "N, M = (int(i) for i in input().split(' '))\npy=[]\np =[]\n\n\nfor i in range(M):\n p = [i]\n p.extend([int(j) for j in input().split(' ')])\n py.append(p)\n\n\npy.sort(key = lambda x: x[2])\npcid = [1] * N \n\nfor i in range(M):\n p = py[i][1] \n py[i][2] = pcid[p-1]\n pcid[p-1] += 1\n\npy.sort(key=lambda x:x[0])\nfor t in py:\n print('{0:0>6}{1:0>6}'.format(t[1],t[2]))\n "]
|
['Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
|
['s094265504', 's308917960', 's475179523', 's950656618', 's778186729']
|
[30628.0, 27924.0, 27900.0, 27916.0, 28256.0]
|
[2105.0, 2105.0, 2108.0, 2105.0, 743.0]
|
[532, 629, 598, 599, 468]
|
p03221
|
u111365362
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["n,m = map(int,input().split())\npref = [[] for _ in range(n)]\ncityrecord = []\nfor i in range(m):\n p,y = map(int,input().split())\n pref[p-1].append([y,i])\n cityrecord.append(p-1)\nfor ni in range(n):\n pref[ni].sort()\nprint(pref)\nfor i in range(m):\n now = cityrecord[i]\n for j in range(len(pref[now])):\n if pref[now][j][1] == i:\n ans = (now + 1) * 10 ** 6 + j + 1\n ANS = str(ans)\n out = '0' * (12 - len(ANS)) + ANS\n print(out)", "P,C = map(int,input().split())\npref = [[] for _ in range(P)]\ncity = []\nfor ci in range(C):\n p,y = map(int,input().split())\n city.append([p-1])\n pref[p-1].append([y,ci])\ncinp = []\nfor pi in range(P):\n pref[pi].sort()\n for j in range(len(pref[pi])):\n citycode = pref[pi][j][1]\n city[citycode].append(j)\nfor ci in range(C):\n pnow = city[ci][0]\n inow = city[ci][1]\n try:\n ans = (pnow+1) * 10 ** 6 + (inow+1)\n except:\n print(pnow,inow,p,cinp)\n ANS = str(ans)\n print( '0' * (12 - len(ANS)) + ANS)"]
|
['Wrong Answer', 'Accepted']
|
['s925957242', 's124701548']
|
[40900.0, 50040.0]
|
[2105.0, 880.0]
|
[451, 513]
|
p03221
|
u113750443
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['def nyu():\n N, M = map(int, input().split())\n S = [list(input().split()) for i in range(M)]\n return N,M,S\n\ndef kansu(N,M,S):\n\n S_tmp=[]\n for i in range(M):\n tmp = [int(S[i][0]),int(S[i][1]),0]\n S_tmp.append(tmp) \n S_tmp.sort()\n tmp = S_tmp[0][0]\n cnt = 1\n\n for i in range(M):\n if tmp == int(S_tmp[i][0]):\n S_tmp[i][2] = cnt\n cnt += 1\n else :\n tmp = S_tmp[i][0]\n S_tmp[i][2] = 1\n cnt = 2\n print(S_tmp)\n for i in range(M):\n for n in range(M):\n # print("S[i][1]=",S[i][1],"S_tmp[n][1]=",S_tmp[n][1])\n if int(S[i][1]) == int(S_tmp[n][1]):\n print(str(S[i][0]).zfill(6),str(S_tmp[n][2]).zfill(6),sep=\'\')\n break\n\n\n\n # for m1 in range(M):\n # cnt = 1\n # tmp_m1 = S[m1][0]\n # tmp_m2 = S[m1][1]\n # for m2 in range(M):\n # if S[m2][0] == tmp_m1 and S[m2][1] < tmp_m2:\n # cnt = cnt + 1\n # print(str(S[m1][0]).zfill(6),str(cnt).zfill(6),sep=\'\')\n\n\nN,M,S = nyu()\nkansu(N,M,S)\n#print(S)\n\n', "def nyu():\n N, M = map(int, input().split())\n S = [list(input().split()) for i in range(M)]\n return N,M,S\n\ndef kansu(N,M,S):\n\n S_tmp=[]\n for i in range(M):\n tmp = [int(S[i][0]),int(S[i][1]),0,i]\n S_tmp.append(tmp) \n S_tmp.sort()\n tmp = S_tmp[0][0]\n cnt = 1\n\n for i in range(M):\n if tmp == int(S_tmp[i][0]):\n S_tmp[i][2] = cnt\n cnt += 1\n else :\n tmp = S_tmp[i][0]\n S_tmp[i][2] = 1\n cnt = 2\n# print(S_tmp)\n S_tmp = sorted(S_tmp, key=lambda x: x[3])\n# print(S_tmp)\n for i in range(M):\n print(str(S_tmp[i][0]).zfill(6),str(S_tmp[i][2]).zfill(6),sep='')\n \n\n\n\n # for m1 in range(M):\n # cnt = 1\n # tmp_m1 = S[m1][0]\n # tmp_m2 = S[m1][1]\n # for m2 in range(M):\n # if S[m2][0] == tmp_m1 and S[m2][1] < tmp_m2:\n # cnt = cnt + 1\n # print(str(S[m1][0]).zfill(6),str(cnt).zfill(6),sep='')\n\n\nN,M,S = nyu()\nkansu(N,M,S)\n#print(S)\n\n"]
|
['Wrong Answer', 'Accepted']
|
['s838954800', 's524297763']
|
[54916.0, 53788.0]
|
[2106.0, 842.0]
|
[1108, 1012]
|
p03221
|
u116233709
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\nli=[]\nans=[]\ncnt=0\nfor i in range(m):\n p,y=map(int,input().split())\n li.append([p,y,i])\nli=sorted(li,key=lambda x:x[1])\nli=sorted(li,key=lambda x:x[0])\npre=li[0][0]\nprint(li)\nfor j in range(m):\n if li[j][0]==pre:\n cnt+=1\n ans.append([str(pre).zfill(6)+str(cnt).zfill(6),li[j][2]])\n \n else:\n pre=li[j][0]\n cnt=1\n ans.append([str(pre).zfill(6)+str(cnt).zfill(6),li[j][2]])\n\nans=sorted(ans,key=lambda x:x[1])\nfor k in range(m):\n print(ans[k][0])', 'n,m=map(int,input().split())\nli=[]\nans=[]\ncnt=0\nfor i in range(m):\n p,y=map(int,input().split())\n li.append([p,y,i])\nli=sorted(li,key=lambda x:x[1])\nli=sorted(li,key=lambda x:x[0])\npre=li[0][0]\nfor j in range(m):\n if li[j][0]==pre:\n cnt+=1\n ans.append([str(pre).zfill(6)+str(cnt).zfill(6),li[j][2]])\n \n else:\n pre=li[j][0]\n cnt=1\n ans.append([str(pre).zfill(6)+str(cnt).zfill(6),li[j][2]])\n\nans=sorted(ans,key=lambda x:x[1])\nfor k in range(m):\n print(ans[k][0])']
|
['Wrong Answer', 'Accepted']
|
['s810252834', 's120449965']
|
[48228.0, 43476.0]
|
[1076.0, 902.0]
|
[528, 518]
|
p03221
|
u118642796
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['from bisect import bisect,bisect_left\n\n\nN,M = map(int,input().split())\n\nd1 = {}\nd2 = {}\nfor i in range(M):\n PY = list(map(int,input().split()))\n tmp = d1.get(PY[0],[])\n ins_pos = bisect(tmp,PY[1])\n tmp.insert(ins_pos,PY[1])\n d1[PY[0]] = tmp\n\nfor py in PY:\n s1 = str(py[0])\n s1 = ("0"*(6-len(s1)))+s1\n s2 = str(bisect_left(d[py[0]],py[1])+1)\n s2 = ("0"*(6-len(s2)))+s2\n\n print(s1+s2)\n', 'N,M = map(int,input().split())\nPY = [list(map(int,input().split()))+[i] for i in range(M)]\n\nnum = [0]*N\nans = [""]*M\n\nPY.sort(key = lambda x:x[1])\n\nfor p,y,i in PY:\n num[p-1] += 1\n ans[i] = str(p).zfill(6) + str(num[p-1]).zfill(6)\n\nfor a in ans:\n print(a)\n']
|
['Runtime Error', 'Accepted']
|
['s046173309', 's179107869']
|
[32860.0, 32616.0]
|
[2104.0, 665.0]
|
[413, 265]
|
p03221
|
u123824541
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\nD = [[] for i in range(N)]\n\nfor i in range(M):\n p, y = map(int, input().split())\n D[p-1].append((y, i))\n\nans = [None]*M\n\nfor i, d in enumerate(D):\n print(d)\n d.sort()\n for k, (y, j) in enumerate(d):\n ans[j] = "%06d%06d" % (i+1, k+1)\n \nprint(*ans, sep=\'\\n\')', 'N, M = map(int, input().split())\nD = [[] for i in range(N)]\n\nfor i in range(M):\n p, y = map(int, input().split())\n D[p-1].append((y, i))\n\nans = [None]*M\n\nfor i, d in enumerate(D):\n d.sort()\n for k, (y, j) in enumerate(d):\n ans[j] = "%06d%06d" % (i+1, k+1)\n \nprint(*ans, sep=\'\\n\')']
|
['Wrong Answer', 'Accepted']
|
['s445553696', 's501552702']
|
[39476.0, 37480.0]
|
[774.0, 596.0]
|
[314, 301]
|
p03221
|
u124735330
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["pre_n, city_n = map(int, input().split())\ncities = [list(map(int, input().split())) for x in range(city_n)]\n\nhistory = {}\n\nA = {}\n\nprint(sorted(cities))\n\nfor x in sorted(cities):\n pref = str(x[0])\n if pref not in history:\n history[pref] = '1'\n\n A.setdefault(str(x), '0'*(6-len(pref)) + pref + '0'*(6-len(history[pref])) + history[pref])\n\n history[pref] = str(int(history[pref]) + 1)\n\nfor x in cities:\n print(A[str(x)])\n", "pre_n, city_n = map(int, input().split())\ncities = [list(map(int, input().split())) for x in range(city_n)]\n\nhistory = {}\n\nA = {}\n\nfor x in sorted(cities):\n pref = str(x[0])\n if pref not in history:\n history[pref] = '1'\n\n A.setdefault(str(x), '0'*(6-len(pref)) + pref + '0'*(6-len(history[pref])) + history[pref])\n\n history[pref] = str(int(history[pref]) + 1)\n\nfor x in cities:\n print(A[str(x)])\n"]
|
['Wrong Answer', 'Accepted']
|
['s943154584', 's769594581']
|
[73764.0, 66464.0]
|
[1233.0, 1001.0]
|
[441, 418]
|
p03221
|
u126232616
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int, input().split())\nY = [[] for _ in range(n)]\nL = []\nfor i in range(m):\n p,yi = map(int, input().split())\n Y[p-1].append(yi)\n L.append(yi)\nfor i in range(n):\n Y[i].sort()\n for k in range(len(Y[i])):\n print(0)', 'n,m = map(int, input().split())\nY = [[] for _ in range(n)]\nL = []\nfor i in range(m):\n p,yi = map(int, input().split())\n Y[p-1].append(yi)\n L.append(yi)\nfor i in range(n):\n Y[i].sort()\n for k in range(len(Y[i])):\n L[L.index(Y[i][k])] = str(i+1).rjust(6,"0") + str(k+1).rjust(6,"0")\n', 'n,m = map(int, input().split())\nY = [[] for _ in range(n)]\nfor i in range(m):\n p,yi = map(int, input().split())\n Y[p-1].append((yi,i))\nans = [-1 for _ in range(m)]\nfor i,d in enumerate(Y):\n d.sort()\n for k,(a,b) in enumerate(d):\n ans[b] = str(i+1).rjust(6,"0") + str(k+1).rjust(6,"0")\nfor i in range(m):\n print(ans[i])']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s052180568', 's787551992', 's893173721']
|
[19628.0, 18864.0, 35944.0]
|
[482.0, 2105.0, 675.0]
|
[243, 303, 340]
|
p03221
|
u129749062
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map(int,input().split())\npy = []\nfor i in range(M):\n py.append(list(map(int,input().split())))\n py[i].append(i)\nsorted_py = sorted(py, key=lambda x: x[1])\nP = [0]*N\np_num = 0\nnum = 0\noutput = ''\noutput2 = []\noutputs = []\nfor i in range(M):\n P[sorted_py[i][0]-1] += 1\n p_num = sorted_py[i][0]\n num = P[sorted_py[i][0]-1]\n output = str(p_num).zfill(6) + str(num).zfill(8)\n output2 = [output, sorted_py[i][2]]\n outputs.append(output2)\nsorted_outputs = sorted(outputs, key=lambda x: x[1])\nfor out in sorted_outputs:\n print(out[0])\n\n ", "N, M = map(int,input().split())\npy = []\nfor i in range(M):\n py.append(list(map(int,input().split())))\n py[i].append(i)\nsorted_py = sorted(py, key=lambda x: x[1])\nP = [0]*N\np_num = 0\nnum = 0\noutput = ''\noutput2 = []\noutputs = []\nfor i in range(M):\n P[sorted_py[i][0]-1] += 1\n p_num = sorted_py[i][0]\n num = P[sorted_py[i][0]-1]\n output = str(p_num).zfill(6) + str(num).zfill(6)\n output2 = [output, sorted_py[i][2]]\n outputs.append(output2)\nsorted_outputs = sorted(outputs, key=lambda x: x[1])\nfor out in sorted_outputs:\n print(out[0])\n\n "]
|
['Wrong Answer', 'Accepted']
|
['s481008563', 's107430159']
|
[49816.0, 49768.0]
|
[590.0, 611.0]
|
[546, 546]
|
p03221
|
u131405882
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['from operator import itemgetter\nN, M = map(int, input().split())\nc=[]\nfor i in range(M):\n\tc.append(input().split())\nfor i in range(M):\n\tc[i].append(i)\nC = sorted(sorted(c,key=itemgetter(1)), key=itemgetter(0))\nx = 1\nfor i in range(M):\n\tif i > 0 and int(C[i][0]) - int(C[i-1][0]) > 0:\n\t\tx = 1\n\telse:\n\t\tx += 1\n\tC[i].append(x)\nc = sorted(C, key=itemgetter(2))\nfor i in range(M):\n\tprint("{:06d}{:06d}".format(int(c[i][0]), int(c[i][3])))', 'from operator import itemgetter\nN, M = map(int, input().split())\nc=[]\nfor i in range(M):\n\tc.append(list(map(int, input().split())))\nfor i in range(M):\n\tc[i].append(i)\nC = sorted(sorted(c,key=itemgetter(1)), key=itemgetter(0))\nx = 0\nfor i in range(M):\n\tif i > 0 and C[i][0] - C[i-1][0] != 0:\n\t\tx = 1\n\telse:\n\t\tx += 1\n\tC[i].append(x)\nc = sorted(C, key=itemgetter(2))\nfor i in range(M):\n\tprint("{:06d}{:06d}".format(c[i][0], c[i][3]))']
|
['Wrong Answer', 'Accepted']
|
['s095289245', 's117290590']
|
[43008.0, 37356.0]
|
[859.0, 867.0]
|
[434, 431]
|
p03221
|
u131411061
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N,M = map(int,input().split())\nd=[0]*M\nres = []\nfor i in range(M):\n P,Y = map(int,input().split())\n res.append((P,Y,i))\nc=1\nprint(res)\nfor i in sorted(res):\n x = str(i[0])\n y = str(i[1])\n tmp = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)\n if(tmp in d):\n c+=1\n d[i[2]] = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)\n else:\n c = 1\n d[i[2]] = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)\n\nfor i in d:\n print(i)", "N,M = map(int,input().split())\nd=[0]*M\nres = []\nfor i in range(M):\n P,Y = map(int,input().split())\n res.append((P,Y,i))\nc=0\nres.sort()\nt = str(res[0][0])\nfor i in res:\n x = str(i[0])\n if x == t:\n c+=1\n else:\n c=1\n t = x\n d[i[2]] = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)\n\nfor i in d:\n print(i)\n"]
|
['Wrong Answer', 'Accepted']
|
['s996078956', 's775245903']
|
[29516.0, 28956.0]
|
[2105.0, 651.0]
|
[457, 340]
|
p03221
|
u131881594
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\npre=[[] for _ in range(n)]\nfor _ in range(m):\n p,y=map(int,input().split())\n pre[p-1].append([y,_,p])\nfor p in range(n):\n pre[p].sort(key=lambda x:x[0])\n for i in range(len(pre[p])):\n pre[p][i].append(i)\nlis=[]\nfor i in pre:\n for j in i:\n lis.append(j)\nlis.sort(key=lambda x:x[1])\nfor i in lis: print("{:06}{:06}".format(i[3]+1,i[2]))', 'n,m=map(int,input().split())\npre=[[] for _ in range(n)]\nfor _ in range(m):\n p,y=map(int,input().split())\n pre[p-1].append([y,_,p])\nfor p in range(n):\n pre[p].sort(key=lambda x:x[0])\n for i in range(len(pre[p])):\n pre[p][i].append(i)\nlis=[]\nfor i in pre:\n for j in i:\n lis.append(j)\nlis.sort(key=lambda x:x[1])\nfor i in lis: print("{:06}{:06}".format(i[2],i[3]+1))']
|
['Wrong Answer', 'Accepted']
|
['s774291403', 's847047990']
|
[46628.0, 46560.0]
|
[588.0, 627.0]
|
[392, 392]
|
p03221
|
u131944095
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map(int, input().split())\nD = [[] for i in range(N)]\n\nfor i in range(M):\n p, y = map(int, input().split())\n D[p-1].append((y, i)) \n\nans = [None]*M\n\nfor i, d in enumerate(D): \n d.sort()\n print(d)\n for k, (y, j) in enumerate(d): \n ans[j] = str(i+1).zfill(6) + str(k+1).zfill(6)\nprint(*ans, sep = '\\n') ", "import sys\ninput = sys.stdin.readline\nn, m = map(int, input().split())\nPY = [list(map(int, input().split())) for _ in range(m)]\ndef make_id(num):\n s = len(str(num))\n add_zero = '0'*(6-s)\n return add_zero + str(num)\n\nP = [[] for _ in range(m)]\nfor i in range(len(PY)):\n P[PY[i][0]-1].append(PY[i][1])\n P[PY[i][0]-1].sort()\nprint(P)\nfor i in range(len(PY)):\n p,y=PY[i][0],PY[i][1]\n ord = P[p-1].index(y)+1\n print(make_id(p)+make_id(ord))\n", "N, M = map(int, input().split())\nD = [[] for i in range(N)]\n \nfor i in range(M):\n p, y = map(int, input().split())\n D[p-1].append((y, i)) \n\nans = [None]*M\n \nfor i, d in enumerate(D): \n d.sort()\n for k, (y, j) in enumerate(d): \n ans[j] = str(i+1).zfill(6) + str(k+1).zfill(6)\nprint(*ans, sep = '\\n') "]
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s500383648', 's918134603', 's389413309']
|
[39508.0, 39624.0, 37480.0]
|
[802.0, 2106.0, 652.0]
|
[315, 444, 306]
|
p03221
|
u134181243
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\nnum=[1]*(n+1)\nansl=[]\nfor i in range(m):\n p,y=map(int,input().split())\n ans="%06d"%p+"%06d"%num[p]\n num[p]+=1\n ansl.append(ans)\nprint(*ansl,sep="\\n")\n', 'import bisect\nimport heapq\nn,m=map(int,input().split())\npy_i=[[int(x) for x in input().split()] for _ in range(m)]\ny_p=[[] for i in range(n+1)]\nfor x,y in sorted(py_i):\n print(x)\n y_p[x].append(y)\nfor x,y in py_i:\n z=bisect.bisect_right(y_p[x],y)\n print("%06d"%x+"%06d"%z)\n\n#print(y_p)', 'import bisect\nimport heapq\nn,m=map(int,input().split())\npy_i=[[int(x) for x in input().split()] for _ in range(m)]\ny_p=[[] for i in range(n+1)]\nfor x,y in sorted(py_i):\n #print(x)\n y_p[x].append(y)\nfor x,y in py_i:\n z=bisect.bisect_right(y_p[x],y)\n print("%06d"%x+"%06d"%z)\n\n#print(y_p)']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s410752967', 's744251614', 's405268086']
|
[13908.0, 35052.0, 34436.0]
|
[473.0, 768.0, 678.0]
|
[191, 297, 298]
|
p03221
|
u136090046
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n, m =map(int, input().split())\npy_array = [[int(x) for x in input().split()]+[y] for x, y in enumerate(range(m), 0)]\npy_array = sorted(py_array, key=lambda x:(x[0], x[1]))\n\nbase = 1\nbase2 = 0\nres_array = []\nfor i, j, k in py_array:\n if base == i:\n base2 += 1\n print(i)\n else:\n base = i\n base2 = 1\n res_array.append([str(base).zfill(6), str(base2).zfill(6), k])\n\nres_array = sorted(res_array, key=lambda x:x[2])\n\nfor i, j, k in res_array:\n print(i, j)', 'n, m =map(int, input().split())\npy_array = [[int(x) for x in input().split()]+[y] for x, y in enumerate(range(m), 0)]\npy_array = sorted(py_array, key=lambda x:(x[0], x[1]))\n\nbase = 1\nbase2 = 0\nres_array = []\nfor i, j, k in py_array:\n if base == i:\n base2 += 1\n print(i)\n else:\n base = i\n base2 = 1\n res_array.append([str(base).zfill(6), str(base2).zfill(6), k])\n\nres_array = sorted(res_array, key=lambda x:x[2])\n\nfor i, j, k in res_array:\n print(i+j)', 'n, m =map(int, input().split())\npy_array = [[int(x) for x in input().split()]+[y] for x, y in enumerate(range(m), 0)]\npy_array = sorted(py_array, key=lambda x:(x[0], x[1]))\n\nbase = 1\nbase2 = 0\nres_array = []\nfor i, j, k in py_array:\n if base == i:\n base2 += 1\n else:\n base = i\n base2 = 1\n res_array.append([str(base).zfill(6), str(base2).zfill(6), k])\n\nres_array = sorted(res_array, key=lambda x:x[2])\n\nfor i, j, k in res_array:\n print(i+j)']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s048485408', 's590175818', 's569485047']
|
[47612.0, 47612.0, 46940.0]
|
[1029.0, 1070.0, 1002.0]
|
[491, 490, 473]
|
p03221
|
u137228327
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N,M = map(int,input().split())\n\nD = [[] for i in range(N)]\n#print(P.sort())\nfor i in range(M):\n p,y = map(int,input().split())\n D[p-1].append((y,i))\n \n\n#D = [[(32,0),(12,2)],[(63,1)]]\n#print(D)\nsubmit = [0]*M\nfor i,d in enumerate(D):\n #print(d)\n d.sort()\n #print(i,d)\n for k, (y,j) in enumerate(d):\n #print(k,y,j)\n submit[j] = str(i+1).zfill(6)+str(k+1).zfill(6)\n \nprint(submit)\nprint(*submit,sep = '\\n')", "N,M = map(int,input().split())\n\nlst = [list(map(int,input().split())) for _ in range(M)]\nD = [[] for i in range(N)]\n#print(lst)\nsubmit =[0]*M\nfor i in range(M):\n D[lst[i][0]-1].append((lst[i][1],i))\n\n#print(D)\n\nfor i,d in enumerate(D):\n #print(i,d)\n d.sort(key=lambda x: x[0])\n #print(d)\n for k,(y,j) in enumerate(d):\n #print(i,k,y,j)\n submit[j] = str(i+1).zfill(6)+str(k+1).zfill(6)\n\nprint(*submit,sep = '\\n')"]
|
['Wrong Answer', 'Accepted']
|
['s075459994', 's933324058']
|
[42124.0, 55580.0]
|
[441.0, 476.0]
|
[501, 439]
|
p03221
|
u143509139
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\np = [list(map(int, input().split())) + [i] for i in range(M)]\np.sort()\nprint(p)\ni = 0\nfor n in range(1, N + 1):\n count = 1\n print(i, p[2][0])\n while not(i > n or p[i][0] != n):\n p[i] += [str(n).zfill(6) + str(count).zfill(6)]\n i += 1\n count += 1\np.sort(key=lambda x: x[2])\nfor a in p:\n print(a[3])', 'N, M = map(int, input().split())\np = [list(map(int, input().split())) + [i] for i in range(M)]\np.sort()\ni = 0\nfor n in range(1, N + 1):\n count = 1\n while not(i >= M or p[i][0] != n):\n p[i] += [str(n).zfill(6) + str(count).zfill(6)]\n i += 1\n count += 1\np.sort(key=lambda x: x[2])\nfor a in p:\n print(a[3])']
|
['Runtime Error', 'Accepted']
|
['s532690408', 's552486127']
|
[36840.0, 35008.0]
|
[910.0, 891.0]
|
[363, 333]
|
p03221
|
u156931988
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['from collections import defaultdict\n\nN,M = map(int,input().split())\nquestion_dic = defaultdict(list)\nquestion_dics = defaultdict(list)\nfor _ in range(M):\n city,value = map(int,input().split())\n question_dic[city].append(value)\nfor key,value in question_dic.items():\n question_dics[key] = sorted(value)\nfor key,value in question_dic.items():\n for v in value:\n print("%06d%06d"%(key,question_dics[key].index(v)+1))\n\n', 'from collections import defaultdict\n\nN,M = map(int,input().split())\nquestion = []\nnumber = {}\ncounts = defaultdict(int)\nfor i in range(M):\n city,value = map(int,input().split())\n question.append([i,city,value])\nsorted_question = sorted(question,key=lambda x: x[2])\nfor i,city,value in sorted_question:\n counts[city] += 1\n number[i] = "{:06}{:06}".format(city,counts[city])\nfor i in range(M):\n print(number[i])']
|
['Wrong Answer', 'Accepted']
|
['s055628499', 's074348176']
|
[47688.0, 47320.0]
|
[2104.0, 637.0]
|
[433, 424]
|
p03221
|
u160244242
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["nm_lst = list(map(int, input().split()))\ncity_lst = [list(map(int, (str(i)+' '+input()).split())) for i in range(nm_lst[1])]\n\ncity_lst = sorted(city_lst, key = lambda x: x[1]*10**7 + x[2])\n\nans_lst = []\nnum_num = 0\nfor n, city in enumerate(city_lst):\n prefec_num = city[1]\n prefec_str = '0' * (6-len(str(prefec_num))) + str(prefec_num)\n if n = 0 or (prefec_num != city_lst[n-1][1]):\n num_str = '000001'\n num_num = 1\n else:\n num_num += 1\n num_str = '0' * (6-len(str(num_num))) + str(num_num)\n ans_lst.append([city[0], prefec_str, num_str])\n \nans_lst = sorted(ans_lst, key = lambda x:x[0])\n\nfor city in ans_lst:\n print(city[1]+city[2])", "nm_lst = list(map(int, input().split()))\ncity_lst = [list(map(int, (str(i)+' '+input()).split())) for i in range(nm_lst[1])]\n\ncity_lst = sorted(city_lst, key = lambda x: x[1]*(10**12) + x[2])\n\nans_lst = []\nnum_num = 0\nfor n, city in enumerate(city_lst):\n prefec_num = city[1]\n prefec_str = '0' * (6-len(str(prefec_num))) + str(prefec_num)\n if n == 0 or (prefec_num != city_lst[n-1][1]):\n num_num = 1\n else:\n num_num += 1\n num_str = '0' * (6-len(str(num_num))) + str(num_num)\n ans_lst.append([city[0], prefec_str, num_str])\n \nans_lst = sorted(ans_lst, key = lambda x:x[0])\n\nfor city in ans_lst:\n print(city[1]+city[2])"]
|
['Runtime Error', 'Accepted']
|
['s641835147', 's760629221']
|
[3060.0, 53968.0]
|
[17.0, 1052.0]
|
[682, 655]
|
p03221
|
u163320134
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["def mks(num):\n s=str(num)\n if len(s)<6:\n s='0'*(6-len(s))+s\n return s\n\nn,m=map(int,input().split())\narr=[]\nfor i in range(m):\n p,y=map(int,input().split)\n arr.append([p,y,i])\nans=[0]*m\narr=sorted(arr,key=lambda x:x[1])\narr=sorted(arr,key=lambda x:x[0])\ntmp=arr[0][0]\ncnt=1\nfor i in range(m):\n if arr[i][0]==tmp:\n s1,s2=mks(tmp),mks(cnt)\n ans[arr[i][2]]=s1+s2\n cnt+=1\n else:\n cnt=1\n tmp=arr[i][0]\n s1,s2=mks(tmp),mks(cnt)\n ans[arr[i][2]]=s1+s2\nfor i in range(m):\n print(ans[i])", "def mks(num):\n s=str(num)\n if len(s)<6:\n s='0'*(6-len(s))+s\n return s\n\nn,m=map(int,input().split())\narr=[]\nfor i in range(m):\n p,y=map(int,input().split())\n arr.append([p,y,i])\nans=[0]*m\narr=sorted(arr,key=lambda x:x[1])\narr=sorted(arr,key=lambda x:x[0])\ntmp=arr[0][0]\ncnt=1\nfor i in range(m):\n if arr[i][0]==tmp:\n s1,s2=mks(tmp),mks(cnt)\n ans[arr[i][2]]=s1+s2\n cnt+=1\n else:\n cnt=1\n tmp=arr[i][0]\n s1,s2=mks(tmp),mks(cnt)\n ans[arr[i][2]]=s1+s2\n cnt+=1\nfor i in range(m):\n print(ans[i])"]
|
['Runtime Error', 'Accepted']
|
['s822924220', 's724960923']
|
[3064.0, 31968.0]
|
[17.0, 847.0]
|
[508, 521]
|
p03221
|
u163449343
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n, m = map(int, input().split())\na = [0] * (n+1)\nb = [list(map(int, input().split())) + [i] + [0] for i in range(m)]\nb.sort(key= lambda x:x[1])\nfor i, (v, x, y, z) in enumerate(b):\n a[v-1] += 1\n b[i][3] = a[v-1]\nb.sort(key = lambda x:x[2])\nfor v,x,y,z in b:\n print("{0:06d}{0:06d}".format(v,z))', 'n, m = map(int, input().split())\na = [0] * (n)\nb = [list(map(int, input().split())) + [i] + [0] for i in range(m)]\nb.sort(key= lambda x:x[1])\nfor i, (v, x, y, z) in enumerate(b):\n a[v-1] += 1\n b[i][3] = a[v-1]\nb.sort(key = lambda x:x[2])\nfor v,x,y,z in b:\n print("{0:06d}{0:06d}".format(v,z))', 'n, m = map(int, input().split())\npli = [1 for x in range(n)]\nfor i in range(m):\n p, y = input().split()\n P = "0" * (6 - int(p)) + p\n Y = "0" * (6 - len(str(pli[(int(p) - 1)]))) + str(pli[(int(p) - 1)])\n print(P + Y)\n pli[(int(p) - 1)] += 1\n\n', 'n, m = map(int, input().split())\na = [0] * (n+1)\nb = [list(map(int, input().split())) + [i] + [0] for i in range(m)]\nb.sort(key= lambda x:x[1])\nfor i, (v, x, y, z) in enumerate(b):\n a[v-1] += 1\n b[i][3] = a[v-1]\nb.sort(key = lambda x:x[2])\nfor v,x,y,z in b:\n print("{0:06d}{1:06d}".format(v,z))']
|
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s455636652', 's535956049', 's739137922', 's629257523']
|
[35960.0, 35960.0, 5136.0, 35960.0]
|
[730.0, 712.0, 964.0, 729.0]
|
[303, 301, 257, 303]
|
p03221
|
u167523937
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["n,m = map(int, input().split())\npy=[]\nfor i in range(m):\n p,y=map(int, input().split())\n py.append([i,p,y])\n\npy.sort(key=lambda x:(x[1],x[2]))\nsorted_py = py\nnum = 1\nprev_p = str(sorted_py[0][1])\nfor i in range(m):\n if prev_p != sorted_py[i][1]:\n num = 1\n p = str(sorted_py[i][1])\n prev_p = p\n str_num = str(num)\n if len(p)!=6:\n p = '0'*(6-len(p))+p\n if len(str_num)!=6:\n str_num = '0'*(6-len(str_num))+str_num\n sorted_py[i].append(p+str_num)\n num+=1\nsorted_py.sort()\nfor i in range(m):\n print(sorted_py[i][3])", "n,m = map(int, input().split())\npy=[]\nfor i in range(m):\n p,y=map(int, input().split())\n py.append([i,p,y])\n\npy.sort(key=lambda x:(x[1],x[2]))\nsorted_py = py\nnum = 1\nprev_p = str(sorted_py[0][1])\nfor i in range(m):\n if prev_p != sorted_py[i][1]:\n num = 1\n p = str(sorted_py[i][1])\n str_num = str(num)\n if len(p)!=6:\n p = '0'*(6-len(p))+p\n if len(str_num)!=6:\n str_num = '0'*(6-len(str_num))+str_num\n sorted_py[i].append(p+str_num)\n prev_p = p\n num+=1\nsorted_py.sort()\nfor i in range(m):\n print(sorted_py[i][3])", "n,m = map(int, input().split())\npy=[]\nfor i in range(m):\n p,y=map(int, input().split())\n py.append([i,p,y])\n\npy.sort(key=lambda x:(x[1],x[2]))\nsorted_py = py\nnum = 1\nprev_p = str(sorted_py[0][1])\nfor i in range(m):\n p = str(sorted_py[i][1])\n if prev_p != p:\n num = 1\n prev_p = p\n str_num = str(num)\n if len(p)!=6:\n p = '0'*(6-len(p))+p\n if len(str_num)!=6:\n str_num = '0'*(6-len(str_num))+str_num\n sorted_py[i].append(p+str_num)\n num+=1\nsorted_py.sort()\nfor i in range(m):\n print(sorted_py[i][3])"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s139395435', 's960795086', 's367200108']
|
[34520.0, 34968.0, 34460.0]
|
[890.0, 883.0, 899.0]
|
[621, 621, 611]
|
p03221
|
u167681750
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n, m= map(int, (input().split()))\npyi = [list(map(int, (input().split()))) + [i] for i in range(m)]\npyi.sort(key=itemgetter(1))\npyi.sort(key=itemgetter(0))\ncityflag = 0\nans = []\nfor rep in range(m):\n if pyi[rep][0] != pyi[rep - 1][0]:\n cityflag = 0\n\n cityflag += 1\n ans += [[pyi[rep][0] , cityflag, pyi[rep][2]]]\n\nfor i in sorted(ans, key=itemgetter(2)):\n print(str(i[0]).zfill(6) + str(i[1]).zfill(6))', 'from operator import itemgetter\n\nn, m= map(int, (input().split()))\npyi = [list(map(int, (input().split()))) + [i] for i in range(m)]\npyi.sort(key=itemgetter(1))\npyi.sort(key=itemgetter(0))\ncityflag = 0\nans = []\nfor rep in range(m):\n if pyi[rep][0] != pyi[rep - 1][0]:\n cityflag = 0\n\n cityflag += 1\n ans += [[pyi[rep][0] , cityflag]]\n\nfor i in sorted(ans):\n print(str(i[0]).zfill(6) + str(i[1]).zfill(6))', 'from operator import itemgetter\n\nn, m= map(int, (input().split()))\npyi = [list(map(int, (input().split()))) + [i] for i in range(m)]\npyi.sort(key=itemgetter(1))\npyi.sort(key=itemgetter(0))\ncityflag = 0\nans = []\nfor rep in range(m):\n if pyi[rep][0] != pyi[rep - 1][0]:\n cityflag = 0\n\n cityflag += 1\n ans += [[pyi[rep][0] , cityflag, pyi[rep][2]]]\n\nfor i in sorted(ans, key=itemgetter(2)):\n print(str(i[0]).zfill(6) + str(i[1]).zfill(6))']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s449314238', 's650904327', 's145559941']
|
[23184.0, 39160.0, 39416.0]
|
[356.0, 791.0, 840.0]
|
[421, 422, 454]
|
p03221
|
u172035535
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N,M = map(int,input().split())\nPY = [list(map(int,input().split())) for _ in range(M)]\nfor i in range(M):\n PY[i].append(i)\nPY.sort(key=lambda x:x[1])\nans = [0]*M\nnum = [0]*N\nfor p,y,i in PY:\n ans[i] = str(p).zfill(6) + str(num[p]+1).zfill(6)\n num[p] += 1\nfor s in ans:print(s)', 'N,M = map(int,input().split())\nPY = [list(map(int,input().split())) for _ in range(M)]\nfor i in range(M):\n PY[i].append(i)\nPY.sort(key=lambda x:x[1])\nans = [0]*M\nnum = [0]*N\nfor p,y,i in PY:\n ans[i] = str(p).zfill(6) + str(num[p-1]+1).zfill(6)\n num[p-1] += 1\nfor s in ans:print(s)']
|
['Runtime Error', 'Accepted']
|
['s037264598', 's698278726']
|
[39876.0, 39884.0]
|
[644.0, 646.0]
|
[285, 289]
|
p03221
|
u174273188
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['import itertools\n\n\ndef solve():\n n, m = map(int, input().split())\n py = list(list(map(int, input().split())) for _ in range(m))\n py_with_key = sorted([(idx, pyi) for idx, pyi in enumerate(py)], key=lambda x: x[1])\n pref_no = 1\n cnt = 0\n ids = []\n for idx, p_y in py_with_key:\n if pref_no == p_y[0]:\n cnt += 1\n else:\n pref_no = p_y[0]\n cnt = 1\n city_id = \'{0:06d}{1:06d}\'.format(p_y[0], cnt)\n ids.append((idx, city_id))\n print("\\n".join([x[1] for x in sorted(ids, key=lambda x: x[0])]))\n\n\nif __name__ == "__main__":\n print(solve())\n', 'def solve():\n n, m = map(int, input().split())\n py = list(list(map(int, input().split())) for _ in range(m))\n py_with_key = sorted([(idx, pyi) for idx, pyi in enumerate(py)], key=lambda x: x[1])\n pref_no = 1\n cnt = 0\n ids = []\n for idx, p_y in py_with_key:\n if pref_no == p_y[0]:\n cnt += 1\n else:\n pref_no = p_y[0]\n cnt = 1\n city_id = \'{0:06d}{1:06d}\'.format(p_y[0], cnt)\n ids.append((idx, city_id))\n return "\\n".join([x[1] for x in sorted(ids, key=lambda x: x[0])])\n\n\nif __name__ == "__main__":\n print(solve())\n']
|
['Wrong Answer', 'Accepted']
|
['s090574792', 's712324546']
|
[56452.0, 54160.0]
|
[775.0, 791.0]
|
[619, 600]
|
p03221
|
u175590965
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = [int(i) for i in input().split()]\na = [[]for i in range(n)]\nb = []\n\nfor i in range(m):\n c,d = [int(i)for i in input().split()]\n a =[c-1].append((d,i))\nans = [None]*m\nfor j,b in enumerate(a):\n b.sort()\n for k,(d,i) in enumerate(b):\n ans[i] = str(j+1).zfill(6)+str(k+1).zfill(6)\nprint(*ans,sep="\\n")', 'n,m = [int(i) for i in input().split()]\na = [[]for i in range(n)]\n\n\nfor i in range(m):\n c,d = map(int,input().split())\n a =[c-1].append((d,i))\nans = [0]*m\nfor i,b in enumerate(a):\n b.sort()\n for k,(d,j) in enumerate(b):\n ans[j] = str(i+1).zfill(6)+str(k+1).zfill(6)\nprint(*ans,sep="\\n")', "N,M=map(int, input().split())\nA=[[] for i in range(N)]\n \nfor i in range(M):\n p,y=map(int, input().split())\n A[p-1].append((y, i))\n \nX=[0]*M\nfor i,d in enumerate(A):\n d.sort()\n for k,(y,j) in enumerate(d):\n X[j]=str(i+1).zfill(6)+str(k+1).zfill(6)\nprint(*X,sep='\\n')"]
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s149308502', 's938857692', 's872645747']
|
[10288.0, 10288.0, 37480.0]
|
[353.0, 353.0, 639.0]
|
[322, 305, 272]
|
p03221
|
u177411511
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["import sys\nfrom collections import deque\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, m = na()\nbuf = [None] * m\ncnt = {k: [] for k in range(n + 1)}\nfor i in range(m):\n p, y = na()\n cnt[p].append((y, i))\nfor p, l in cnt.items():\n if not l:\n continue\n l.sort()\n print(l)\n for j, (y, i) in enumerate(l):\n buf[i] = '{:06d}{:06d}'.format(p, j + 1)\n\nprint('\\n'.join(buf))\n\n", "import sys\nfrom collections import deque\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, m = na()\nbuf = [None] * m\ncnt = {k: [] for k in range(n + 1)}\nfor i in range(m):\n p, y = na()\n cnt[p].append((y, i))\nprint(cnt)\nfor p, l in cnt.items():\n if not l:\n continue\n l.sort()\n print(l)\n for j, (y, i) in enumerate(l):\n buf[i] = '{:06d}{:06d}'.format(p, j + 1)\n\nprint('\\n'.join(buf))\n\n", "import sys\nfrom collections import deque\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, m = na()\nbuf = [None] * m\ncnt = {k: [] for k in range(n + 1)}\nfor i in range(m):\n p, y = na()\n cnt[p].append((y, i))\nfor p, l in cnt.items():\n if not l:\n continue\n l.sort()\n for j, (y, i) in enumerate(l):\n buf[i] = '{:06d}{:06d}'.format(p, j + 1)\n\nprint('\\n'.join(buf))\n\n"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s040864741', 's820694135', 's996543458']
|
[56684.0, 59516.0, 53472.0]
|
[698.0, 767.0, 511.0]
|
[519, 530, 506]
|
p03221
|
u177756077
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N,M=map(int,input().split())\nPY=[]\nfor i in range(M):\n array=list(map(int,input().strip().split()))\n PY.append(array)\n\nPY.sort()\ncity=0\norder=0\nfor i in range(M):\n newcity=PY[i][0]\n if(newcity!=city):\n city=newcity\n order=1\n strcity=str(PY[i][0])\n strorder=str(order)\n upper='0'*(6-len(strcity))+strcity\n lower='0'*(6-len(strorder))+strorder\n order=order+1\n print(upper+lower)", "for i in range(M):\n array=list(map(int,input().strip().split()))\n PY.append(array)\n\nPY.sort()\ncity=0\norder=0\nfor i in range(M):\n newcity=PY[i][0]\n if(newcity!=city):\n city=newcity\n order=1\n strcity=str(PY[i][0])\n strorder=str(order)\n upper='0'*(6-len(strcity))+strcity\n lower='0'*(6-len(strorder))+strorder\n order=order+1\n print(upper+lower)", 'N,M=map(int,input().split())\nbirth=[]\nfor i in range(M):\n p,y=map(int,input().split())\n birth.append([i,p,y])\n\nbirth.sort(key=lambda x:(x[1],x[2]))\n\nbirth[0].append(0)\ncnt=0\nfor i in range(M-1):\n if birth[i][1]==birth[i+1][1]:\n cnt+=1\n else:\n cnt=0\n birth[i+1].append(cnt)\n\nbirth.sort(key=lambda x:x[0])\nfor i in range(M):\n ans=str(birth[i][1]).zfill(6)+str(birth[i][3]+1).zfill(6)\n print(ans)\n']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s301391138', 's411297284', 's032618336']
|
[29584.0, 3064.0, 35484.0]
|
[725.0, 17.0, 795.0]
|
[420, 385, 429]
|
p03221
|
u185688520
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["n, m = map(int, input().split())\ndata = [0] * m\nres = [0] * m\nfor i in range(m):\n d = list(map(int, input().split()))\n d.append(i)\n data[i] = tuple(d)\ndata.sort()\ncity_num = data[0][0]\nbirth_num = 1\nprint(data)\nfor item in data:\n # print(item, city_num)\n if item[0] != city_num:\n city_num = item[0]\n birth_num = 1\n res[item[2]] = '{:06d}{:06d}'.format(item[0], birth_num)\n birth_num += 1\nfor item in res:\n print(item)\n", "n, m = map(int, input().split())\ndata = [0] * m\nres = [0] * m\nfor i in range(m):\n d = list(map(int, input().split()))\n d.append(i)\n data[i] = tuple(d)\ndata.sort()\ncity_num = data[0][0]\nbirth_num = 1\n# print(data)\nfor item in data:\n # print(item, city_num)\n if item[0] != city_num:\n city_num = item[0]\n birth_num = 1\n res[item[2]] = '{:06d}{:06d}'.format(item[0], birth_num)\n birth_num += 1\nfor item in res:\n print(item)\n"]
|
['Wrong Answer', 'Accepted']
|
['s238046424', 's305663915']
|
[31912.0, 29056.0]
|
[772.0, 678.0]
|
[456, 458]
|
p03221
|
u185896732
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\nt=[[] for _ in range(n)]\nfor i in range(m):\n p,y=map(int,input().split())\n t[p-1].append((y,i))\nans=[""]*m\nfor i,j in enumerate(t,1):\n j.sort()\n for k,(j,l) in enumerate(j,1):\n print(l)\n ans[l]=str(i).zfill(6)+str(k).zfill(6)\nprint("\\n".join(ans))', 'n,m=map(int,input().split())\nt=[[] for _ in range(n)]\nfor i in range(m):\n p,y=map(int,input().split())\n t[p-1].append((y,i))\nans=[""]*m\nfor i,j in enumerate(t,1):\n j.sort()\n for k,(j,l) in enumerate(j,1):\n ans[l]=str(i).zfill(6)+str(k).zfill(6)\nprint("\\n".join(ans))']
|
['Wrong Answer', 'Accepted']
|
['s333046509', 's202743779']
|
[39268.0, 38376.0]
|
[722.0, 581.0]
|
[302, 285]
|
p03221
|
u187516587
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['import sys\ndef input():\n return sys.stdin.readline()[:-1]\nN,M=map(int,input().split())\nl=[None]*M\nfor i in range(M):\n P,Y=map(int,input().split())\n l[i]=(P,Y,i)\nl.sort()\na=[None]*M\ns=0\nt=1\nfor i in l:\n if i[0]==s:\n t+=1\n else:\n t=1\n s=i[0]\n a[i[2]]="{:06d}".format(i[0]) + "{:06d}".format(t)\nprint(a)', 'import sys\ndef input():\n return sys.stdin.readline()[:-1]\nN,M=map(int,input().split())\nl=[None]*M\nfor i in range(M):\n P,Y=map(int,input().split())\n l[i]=(P,Y,i)\nl.sort()\na=[None]*M\ns=0\nt=1\nfor i in l:\n if i[0]==s:\n t+=1\n else:\n t=1\n s=i[0]\n a[i[2]]="{:06d}".format(i[0]) + "{:06d}".format(t)\nprint(*a,sep="\\n")']
|
['Wrong Answer', 'Accepted']
|
['s412149370', 's924467258']
|
[32592.0, 30564.0]
|
[448.0, 506.0]
|
[339, 349]
|
p03221
|
u191829404
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0\n# abcde\ts=input()\ts=\'abcde\'\n# abcde\ts=list(input())\ts=[\'a\', \'b\', \'c\', \'d\', \'e\']\n\n# 1 2\tx,y = map(int,input().split())\tx=1,y=2\n\n\n\n\n# 3\n# hoge\n# foo\n# bar\n# n=int(input())\n\n# N, M = map(int,input().split())\n\n# P, Y = [], []\n# for _ in range(M):\n# P_i, Y_i = = map(int,input().split())\n# P.append(P_i)\n# Y.append(Y_i)\n\nN, M = map(int, input().split())\npy = {}\nall_py = []\nfor _ in range(M):\n p, y = map(int, input().split())\n if not p in py:\n py[p] = []\n py[p].append(y)\n all_py.append([p, y])\n\nsort_p = {}\nfor k, v in all_py:\n if not k in sort_p:\n sort_p[k] = sorted(py[k])\n print("{}{}".format(str(k).zfill(8), str((sort_p[k]).index(v)+1).zfill(8)))', '# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0\n# abcde\ts=input()\ts=\'abcde\'\n# abcde\ts=list(input())\ts=[\'a\', \'b\', \'c\', \'d\', \'e\']\n\n# 1 2\tx,y = map(int,input().split())\tx=1,y=2\n\n\n\n\n# 3\n# hoge\n# foo\n# bar\n# n=int(input())\n\n# N, M = map(int,input().split())\n\n# P, Y = [], []\n# for _ in range(M):\n# P_i, Y_i = = map(int,input().split())\n# P.append(P_i)\n# Y.append(Y_i)\n\nN, M = map(int, input().split())\npy = {}\nfor _ in range(M):\n p, y = map(int, input().split())\n if not p in py:\n py[p] = []\n py[p].append(y)\n\nfor i in py:\n sort_p = sorted(py[i])\n for j in py[i]:\n print("{}{}".format(str(i).zfill(8), str(sort_p.index(j)+1).zfill(8)))', '# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0\n# abcde\ts=input()\ts=\'abcde\'\n# abcde\ts=list(input())\ts=[\'a\', \'b\', \'c\', \'d\', \'e\']\n\n# 1 2\tx,y = map(int,input().split())\tx=1,y=2\n\n\n\n\n# 3\n# hoge\n# foo\n# bar\n# n=int(input())\n\n# N, M = map(int,input().split())\n\n# P, Y = [], []\n# for _ in range(M):\n# P_i, Y_i = map(int,input().split())\n# P.append(P_i)\n# Y.append(Y_i)\ndef inpl(): return list(map(int, input().split()))\n\nN, M = inpl()\nA = [""]*M\nP = [[] for _ in range(N+1)]\nfor i in range(M):\n p, y = inpl()\n P[p].append((y, i))\n\n# print(P)\nfor ind, p in enumerate(P):\n p = sorted(p, key=lambda x: x[0])\n for j, (y, i) in enumerate(p):\n A[i] = "{}{}".format(str(ind).zfill(6), str(j+1).zfill(6))\n\nprint("\\n".join(A))\n']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s055232399', 's827290891', 's648726596']
|
[58184.0, 28240.0, 44536.0]
|
[2105.0, 2104.0, 839.0]
|
[1014, 947, 1023]
|
p03221
|
u196697332
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\n\nP = [0] * M\nY = [0] * M\ndic = {}\nano_dic = {}\nfor m in range(M):\n line = list(map(int, input().split()))\n P[m] = line[0]\n Y[m] = line[1]\n \n dic[m] =[P[m], Y[m]]\n\n\nID = {}\ncount = 0\nsorted_list = sorted(dic.items(), key=lambda x: (x[1][0], x[0]))\n\n\nfor i, item in enumerate(sorted_list):\n if item[1][0] == sorted_list[i - 1][1][0]:\n count += 1\n ID[item[0]] = str(item[1][0]).zfill(6) + str(count).zfill(6)\n else:\n count = 1\n ID[item[0]] = str(item[1][0]).zfill(6) + str(count).zfill(6)\n\nfor item in sorted(ID.items(), key=lambda x: x[0]):\n print(item[1])', 'N, M = map(int, input().split())\n\nP = [0] * M\nY = [0] * M\ndic = {}\nano_dic = {}\nfor m in range(M):\n line = list(map(int, input().split()))\n P[m] = line[0]\n Y[m] = line[1]\n \n dic[m] =[P[m], Y[m]]\n\n\nID = {}\ncount = 0\nsorted_list = sorted(dic.items(), key=lambda x: (x[1][0], x[1][1]))\n\n\n\nfor i, item in enumerate(sorted_list):\n if item[1][0] == sorted_list[i - 1][1][0]:\n count += 1\n ID[item[0]] = str(item[1][0]).zfill(6) + str(count).zfill(6)\n else:\n count = 1\n ID[item[0]] = str(item[1][0]).zfill(6) + str(count).zfill(6)\n\nfor item in sorted(ID.items(), key=lambda x: x[0]):\n print(item[1])']
|
['Wrong Answer', 'Accepted']
|
['s664601186', 's700267615']
|
[59016.0, 58948.0]
|
[881.0, 921.0]
|
[639, 643]
|
p03221
|
u197545363
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\nl=[]\nfor i in range(n):l.append([])\nfor i in range(m):\n p,y=map(int,input().split())\n l[p-1].append((i,y))\nrl=[]\nfor i in range(n):\n ll=l[i]\n ll.sort(key=lambda x:x[1])\n hd="000000"+str(i+1)[-6:]\n rr=[(ll[j][0],hd+("000000"+str(j+1))[-6:]) for j in range(len(ll))]\n rl+=rr\nrl.sort()\nfor e in rl:\n print(e[1])\n', 'n,m=map(int,input().split())\nl=[]\nfor i in range(n):l.append([])\nfor i in range(m):\n print(i)\n p,y=map(int,input().split())\n l[p-1].append((i,y))\nrl=[]\nfor i in range(n):\n ll=l[i]\n ll.sort(key=lambda x:x[1])\n hd="000000"+str(i+1)[-6:]\n rr=[(ll[j][0],hd+("000000"+str(j+1))[-6:]) for j in range(len(ll))]\n rl+=rr\nrl.sort()\nfor e in rl:\n print(e[1])\n', 'n,m=map(int,input().split())\nl=[]\nfor i in range(n):l.append([])\nfor i in range(m):\n p,y=map(int,input().split())\n l[p-1].append((i,y))\nrl=[]\nfor i in range(n):\n ll=l[i]\n ll.sort(key=lambda x:x[1])\n hd=("000000"+str(i+1))[-6:]\n rr=[(ll[j][0],hd+("000000"+str(j+1))[-6:]) for j in range(len(ll))]\n rl+=rr\nrl.sort()\nfor e in rl:\n print(e[1])\n']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s459801432', 's984066502', 's081220221']
|
[43676.0, 44160.0, 42336.0]
|
[930.0, 1479.0, 887.0]
|
[362, 375, 364]
|
p03221
|
u197955752
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = [int(x) for x in input().split()]\n\nPREF = 0\nYEAR = 1\nPY = [tuple(int(x) for x in input().split()) for _ in range(M)]\n\nPY.sort()\n\nord = 1 \nfor i in range(M):\n if i > 0 and PY[i][PREF] == PY[i - 1][PREF]:\n ord += 1\n else:\n ord = 1\n print('{:0>6}{:0>6}'.format(str(PY[i][PREF]), str(ord)))\n", 'N, M = [int(x) for x in input().split()]\n\nCITYID = 2\nPREF = 0\nYEAR = 1\ncity = [[int(x) for x in input().split()] + [i] for i in range(M)]\n\ncity.sort()\n\nid = [""] * M\nfor i in range(M):\n print(city[i])\n\nord = 1 \nfor i in range(M):\n if i > 0 and city[i][PREF] == city[i - 1][PREF]:\n ord += 1\n else:\n ord = 1\n id[city[i][CITYID]] = \'{:0>6}{:0>6}\'.format(str(city[i][PREF]), str(ord))\n\nfor i in range(M):\n print(id[i])\n', 'N, M = [int(x) for x in input().split()]\n\nCITYID = 2\nPREF = 0\nYEAR = 1\ncity = [[int(x) for x in input().split()] + [i] for i in range(M)]\n\ncity.sort()\nid = [""] * M\nord = 1 \n\nfor i in range(M):\n if i > 0 and city[i][PREF] == city[i - 1][PREF]:\n ord += 1\n else:\n ord = 1\n id[city[i][CITYID]] = \'{:0>6}{:0>6}\'.format(str(city[i][PREF]), str(ord))\n\nfor i in range(M):\n print(id[i])\n']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s543519021', 's612228430', 's820786267']
|
[17904.0, 33836.0, 31296.0]
|
[661.0, 909.0, 738.0]
|
[344, 471, 432]
|
p03221
|
u201234972
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map( int, input().split())\nX = [(0,0)]*M\nY = [1]*(N+1)\nfor i in range(M):\n p,y = map( int, input().split())\n X[i] = (y,p)\nX.sort()\nfor i in range(M):\n y, p = X[i]\n ans = '%06d'%p + '%06d'%Y[p]\n print(ans)\n Y[p] += 1", "N, M = map( int, input().split())\nX = [(0,0,0)]*M\nY = [1]*(N+1)\nfor i in range(M):\n p,y = map( int, input().split())\n X[i] = (y,p,i)\nX.sort()\nANS = ['']*M\nfor i in range(M):\n y, p, j = X[i]\n ans = '%06d'%p + '%06d'%Y[p]\n ANS[j] = ans\n Y[p] += 1\nfor i in range(M):\n print(ANS[i])"]
|
['Wrong Answer', 'Accepted']
|
['s695754081', 's508042292']
|
[18700.0, 29796.0]
|
[569.0, 604.0]
|
[240, 299]
|
p03221
|
u210440747
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["#!/usr/bin/env python3\n# -*- coding:utf-8 -*-\n\ndef main():\n n, m = map(int, input().split())\n ipy = [(i+1, )+(tuple(map(int, input().split()))) for i in range(m)]\n kens = set([p for i,p,y in ipy])\n di = {ken:0 for ken in kens}\n\n ans = []\n for i,p,y in ipy:\n di[p] += 1\n number = ('%06d%06d' % (p, di[p]))\n ans += [(i, number)]\n ans.sort(key=lambda x:x[0])\n\n for _, number in ans:\n print(number)\n pass\n\nif __name__=='__main__':\n main()", "#!/usr/bin/env python3\n# -*- coding:utf-8 -*-\n\ndef main():\n n, m = map(int, input().split())\n ipy = [(i+1, )+(tuple(map(int, input().split()))) for i in range(m)]\n ipy.sort(key=lambda x:x[2])\n kens = set([p for i,p,y in ipy])\n di = {ken:0 for ken in kens}\n\n ans = []\n print(ipy)\n for i,p,y in ipy:\n di[p] += 1\n number = ('%06d%06d' % (p, di[p]))\n ans += [(i, number)]\n ans.sort(key=lambda x:x[0])\n\n for _, number in ans:\n print(number)\n pass\n\nif __name__=='__main__':\n main()", "#!/usr/bin/env python3\n# -*- coding:utf-8 -*-\n\ndef main():\n n, m = map(int, input().split())\n ipy = [(i+1, )+(tuple(map(int, input().split()))) for i in range(m)]\n ipy.sort(key=lambda x:x[2])\n kens = set([p for i,p,y in ipy])\n di = {ken:0 for ken in kens}\n\n ans = []\n for i,p,y in ipy:\n di[p] += 1\n number = ('%06d%06d' % (p, di[p]))\n ans += [(i, number)]\n ans.sort(key=lambda x:x[0])\n\n for _, number in ans:\n print(number)\n pass\n\nif __name__=='__main__':\n main()"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s384390237', 's616131187', 's998110253']
|
[47636.0, 52340.0, 47728.0]
|
[519.0, 775.0, 731.0]
|
[456, 499, 486]
|
p03221
|
u215743476
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["from operator import itemgetter\n\nn, m = map(int, input().split())\np, y = [], []\nfor i in range(m):\n p_, y_ = map(int, input().split())\n p.append(p_), y.append(y_)\n\nx = [0] * n\npn = [i for i in range(1, m+1)]\nidn = [''] * m\nyp = list(zip(y, p, pn, idn))\nyp.sort()\n\nfor i in range(m):\n p_ = p[i] - 1\n x[p_] += 1\n idn[i] = format(p[i], '0>6') + format(x[p_], '0>6')\n\nyp.sort(key=itemgetter(2))\nfor i in range(m):\n print(idn[i])", "from operator import itemgetter\n\nn, m = map(int, input().split())\np, y = [], []\nfor i in range(m):\n p_, y_ = map(int, input().split())\n p.append(p_), y.append(y_)\n\nx = [0] * n\npn = [i for i in range(1, m+1)]\nidn = [''] * m\n\nyp = list(zip(y, p, pn))\nyp.sort()\n\nfor i in range(m):\n p_ = yp[i][1] - 1\n x[p_] += 1\n idn[i] = format(yp[i][1], '0>6') + format(x[p_], '0>6')\n\ny, p, pn = zip(*yp)\nyp = list(zip(y, p, pn, idn))\nyp.sort(key=itemgetter(2))\nfor i in range(m):\n print(yp[i][3])\n"]
|
['Wrong Answer', 'Accepted']
|
['s352327664', 's566875137']
|
[33548.0, 41548.0]
|
[703.0, 809.0]
|
[442, 499]
|
p03221
|
u216752093
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["from collections import defaultdict\nfrom bisect import bisect\nn,m=map(int,input().split())\nl=[list(map(int,input().split()) for _ in range(m))]\na=defaultdict(list)\nfor x,y in sorted(l):\n a[x]+=[y]\n\nfor x,y in l:\n z=bisect(a[x],y)\n print('%06d%06d'%(x,z))", "from collections import defaultdict\nfrom bisect import bisect\nn,m=map(int,input().split())\nl=[tuple(map(int,input().split())) for _ in range(m)]\na=defaultdict(list)\nfor x,y in sorted(l):\n a[x]+=[y]\n\nfor x,y in l:\n z=bisect(a[x],y)\n print('%06d%06d'%(x,z))"]
|
['Runtime Error', 'Accepted']
|
['s694353537', 's768658634']
|
[52936.0, 39992.0]
|
[337.0, 454.0]
|
[263, 264]
|
p03221
|
u217086212
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n, m = list(map(int, input().split()))\ncity_list = [[] for i in range(n)]\nnumbers = []\n\nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list[pm-1].append(ym)\n\nfor i in range(n):\n city_list[i].sort()\n for j in range(len(city_list[i])):\n print("{:0=6}{:0=6}".format(i+1, j+1))\n', 'n, m = list(map(int, input().split()))\ncity_list = [[] for i in range(n)]\n\nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list[pm-1].append(ym)\n\nfor i in range(n):\n city_list_copied[i].sort()\n for j in range(len(city_list[i])):\n cindex = sum(x <= city_list[i][j] for x in city_list[i])\n print("{:0=6}{:0=6}".format(i+1, cindex))\n', 'n, m = list(map(int, input().split()))\ncity_list = [[] for i in range(n)]\n\nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list[pm-1].append(ym)\ncity_list_copied = copy.deepcopy(city_list)\n\nfor i in range(n):\n city_list_copied[i].sort()\n for j in range(len(city_list[i])):\n cindex = sum(x <= city_list[i][j] for x in city_list[i])\n print("{:0=6}{:0=6}".format(i+1, cindex))\n', 'import copy\nn, m = list(map(int, input().split()))\ncity_list = [[] for i in range(n)]\nnumbers = []\n \nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list[pm-1].append(ym)\ncity_list_copied = copy.deepcopy(city_list)\n \nfor i in range(n):\n city_list_copied[i].sort()\n for j in range(len(city_list[i])):\n cindex = city_list_copied[i].index(city_list[i][j])\n print("{:0=6}{:0=6}".format(i+1, cindex+1))', 'n, m = list(map(int, input().split()))\ncity_list = []\n\nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list.append([i,pm,ym])\n\ncity_count = {}\ncity = {}\n\nfor i,p,y in sorted(city_list, key=lambda x: x[1]):\n if not p in city_count:\n city_count[p] = 1\n else:\n city_count[p] += 1\n city[i,p] = city_count[p]\n\nfor i,p,y in city_list:\n print("{:0=6}{:0=6}".format(p, city[i,p]))', 'n, m = list(map(int, input().split()))\ncity_list = []\n\nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list.append([i,pm,ym])\n\ncity_count = {}\ncity = {}\n\nfor i,p,y in sorted(city_list, key=lambda x: x[2]):\n if not p in city_count:\n city_count[p] = 1\n else:\n city_count[p] += 1\n city[i,p] = city_count[p]\n\nfor i,p,y in city_list:\n print("{:0=6}{:0=6}".format(p, city[i,p]))']
|
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s134925583', 's511259111', 's604483260', 's645322335', 's945122876', 's459337343']
|
[25496.0, 24112.0, 24112.0, 45168.0, 47320.0, 47320.0]
|
[640.0, 403.0, 394.0, 2105.0, 731.0, 766.0]
|
[313, 375, 419, 442, 423, 423]
|
p03221
|
u220904910
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int, input().split())\nl = [[int(i) for i in input().split()] for i in range(m)]\n\nfor i in range(m):\n l[i].append(i)\nl = sorted(l,key=lambda x: (x[0],x[1]))\n\nl[0].append(1)\nfor i in range(1,m):\n if l[i][0]!=l[i-1][0]:\n l[i].append(1)\n else:\n l[i].append(l[i-1][3]+1)\n\nfor i in range(m):\n l[i].append(str(l[i][0]).zfill(6) + l[i][3].zfill(6))\n\nl=sorted(l,key=lambda x:(x[2]))\n\nfor i in range(m):\n print(l[i][4])', "n,m=map(int, input().split())\nl=[input().split() for i in range(m)]\nm,m_sort={},{}\nlab={}\nfor j in range(len(l)):\n if l[j][0] not in m.keys():\n m[l[j][0]],m_sort[l[j][0]]=[],[]\n m[l[j][0]].append(l[j][1])\n m_sort[l[j][0]].append(l[j][1])\n m_sort[l[j][0]].sort()\nfor k in m.keys():\n p='0'*(6-len(k))+k\n for h in range(len(m[k])):\n q='0'*(6-len(str(h+1)))+str(h+1)\n key=l.index([k,m[k][h]])\n lab[key]=p+q\nfor k,v in sorted(lab.items()):\n print(v)", 'n,m=map(int, input().split())\nl = [[int(i) for i in input().split()] for i in range(m)]\n\nfor i in range(m):\n l[i].append(i)\nl = sorted(l,key=lambda x: (x[0],x[1]))\n\nl[0].append(1)\nfor i in range(1,m):\n if l[i][0]!=l[i-1][0]:\n l[i].append(1)\n else:\n l[i].append(l[i-1][3]+1)\n\nfor i in range(m):\n l[i].append(str(l[i][0]).zfill(6) + str(l[i][3]).zfill(6))\n\nl=sorted(l,key=lambda x:(x[2]))\n\nfor i in range(m):\n print(l[i][4])\n']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s222437509', 's403733213', 's468250212']
|
[33164.0, 67536.0, 40672.0]
|
[544.0, 2107.0, 956.0]
|
[446, 493, 452]
|
p03221
|
u222207357
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['# coding: utf-8\n# Your code here!\n\nN,M = map(int,input().split())\npy= []\n\nfor i in range(M):\n pp,yy = map(int,input().split())\n py.append((pp,yy,i))\n\npy.sort()\n\ncnt = 1\npp_prev = 0\ncode = [\'\' for _ in range(M)]\n\nfor pp,yy,i in py:\n if pp == pp_prev:\n cnt += 1 \n else:\n cnt = 1\n code[i] = "%06d%06d"%(pp,cnt)\n \nprint(*code,sep=\'\\n\')', 'N,M = map(int,input().split())\nyi= [[] for i in range(N)]\n\nfor i in range(M):\n pp,yy = map(int,input().split())\n yi[pp-1].append((yy,i))\n\ncode = [\'\' for _ in range(M)]\n\nfor pp,d in enumerate(yi):\n d.sort()\n for x, (yy,i) in enumerate(d):\n code[i] = "%06d%06d"%(pp+1,x+1)\n \nprint(*code,sep=\'\\n\')']
|
['Wrong Answer', 'Accepted']
|
['s476937143', 's317770593']
|
[30736.0, 37480.0]
|
[546.0, 579.0]
|
[362, 316]
|
p03221
|
u223904637
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["import numpy as np\nn,m=map(int,input().split())\nd=[[] for i in range(n)]\nl=[]\nfor i in range(m):\n a,b=map(int,input().split())\n d[a-1].append(b)\n l.append(a)\nx=[[] for i in range(n)]\nfor i in range(n):\n d[i]=list(np.argsort(d[i]))\n tmp=[0]*len(d[i])\n for j in range(len(d[i]):\n tmp[d[i][j]]=j+1\n x[i]=tmp\nfor i in range(m):\n b=x[l[i]-1].pop(0)\n b+=1\n p=len(list(str(l[i])))\n q=len(list(str(b)))\n ans=''\n for j in range(6-p):\n ans+='0'\n ans+=str(l[i])\n for j in range(6-q):\n ans+='0'\n ans+=str(b)\n print(ans)\n", "import numpy as np\nn,m=map(int,input().split())\nd=[[]*m for i in range(n)]\nl=[]\nfor i in range(m):\n a,b=map(int,input().split())\n d[a-1].append(b)\n l.append(a)\n\nfor i in range(n):\n d[i]=np.argsort(d[i])\n \nfor i in range(m):\n b=d[l[i]-1].pop(0)\n b+=1\n p=len(list(str(l[i])))\n q=len(list(str(b)))\n ans=''\n for j in range(6-p):\n ans+='0'\n ans+=str(l[i])\n for j in range(6-q):\n ans+='0'\n ans+=str(b)\n print(ans)", "n,m=map(int,input().split())\nl=[]\nfor i in range(m):\n a,b=map(int,input().split())\n l.append([a,b])\nx=sorted(l)\ndic={}\nx.append([0,0])\nf=1\nfor i in range(m):\n if x[i][0]==x[i+1][0]:\n dic[str(x[i][0])+'000000'+str(x[i][1])]=f\n f+=1\n else:\n dic[str(x[i][0])+'000000'+str(x[i][1])]=f\n f=1\nfor i in range(m):\n b=dic[str(l[i][0])+'000000'+str(l[i][1])]\n p=len(list(str(l[i])))\n q=len(list(str(b)))\n ans=''\n for j in range(6-p):\n ans+='0'\n ans+=str(l[i])\n for j in range(6-q):\n ans+='0'\n ans+=str(b)\n print(ans)\n", "n,m=map(int,input().split())\nl=[]\nfor i in range(m):\n a,b=map(int,input().split())\n l.append([a,b])\nx=sorted(l)\ndic={}\nx.append([0,0])\nf=1\nfor i in range(m):\n if x[i][0]==x[i+1][0]:\n dic[str(x[i][0])+'000000'+str(x[i][1])]=f\n f+=1\n else:\n dic[str(x[i][0])+'000000'+str(x[i][1])]=f\n f=1\nfor i in range(m):\n b=dic[str(l[i][0])+'000000'+str(l[i][1])]\n p=len(list(str(l[i][0])))\n q=len(list(str(b)))\n ans=''\n for j in range(6-p):\n ans+='0'\n ans+=str(l[i][0])\n for j in range(6-q):\n ans+='0'\n ans+=str(b)\n print(ans)\n"]
|
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
|
['s140072812', 's721214771', 's944359151', 's498844996']
|
[3064.0, 38488.0, 39528.0, 38764.0]
|
[18.0, 1281.0, 1286.0, 1233.0]
|
[580, 466, 587, 593]
|
p03221
|
u224050758
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = [int(n) for n in input().split()]\n\ndef main():\n ps = [[] for _ in range(N)]\n print(ps)\n\n for m in range(M):\n p, y = [int(n) for n in input().split()]\n pref = ps[p - 1]\n pref.append([m, y])\n\n result = []\n\n for i, pref in enumerate(ps):\n pref.sort(key=lambda p: p[1])\n for j, p in enumerate(pref):\n result.append([p[0], '{:06}{:06}'.format(i + 1, j + 1)])\n\n result.sort(key=lambda x: x[0])\n\n for p in result:\n print(p[1])\n\n # ans = '\\n'.join(map(lambda p: p[1], result))\n # print(ans)\n\nif __name__ == '__main__':\n main()", "N, M = [int(n) for n in input().split()]\n\ndef main():\n ps = [[] for _ in range(N)]\n print(ps)\n\n for m in range(M):\n p, y = [int(n) for n in input().split()]\n pref = ps[p - 1]\n pref.append([m, y])\n\n result = []\n\n for i, pref in enumerate(ps):\n pref.sort(key=lambda p: p[1])\n for j, p in enumerate(pref):\n result.append([p[0], '{:06}{:06}'.format(i + 1, j + 1)])\n\n result.sort(key=lambda x: x[0])\n\n ans = '\\n'.join(map(lambda p: p[1], result))\n print(ans)\n\nif __name__ == '__main__':\n main()", "N, M = [int(n) for n in input().split()]\n\ndef main():\n ps = [[] for _ in range(N)]\n\n for m in range(M):\n p, y = [int(n) for n in input().split()]\n pref = ps[p - 1]\n pref.append([m, y])\n\n result = []\n\n for i, pref in enumerate(ps):\n pref.sort(key=lambda p: p[1])\n for j, p in enumerate(pref):\n result.append([p[0], '{:06}{:06}'.format(i + 1, j + 1)])\n\n result.sort(key=lambda x: x[0])\n\n ans = '\\n'.join(map(lambda p: p[1], result))\n print(ans)\n\nif __name__ == '__main__':\n main()"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s603129289', 's756608297', 's539663741']
|
[49300.0, 51468.0, 51028.0]
|
[909.0, 1019.0, 890.0]
|
[608, 562, 548]
|
p03221
|
u225388820
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m= map(int, input().split())\nx=[[] for j in range(n)]\nfor i in range(m):\n p,ye= map(int, input().split())\n x[p-1].append([ye,i])\nfor i in range(n):\n x[i].sort()\ny=[0]*m\ncnt=1\nfor i in range(n):\n for a in range(len(x[i])):\n j=str(i+1)\n k=str(cnt)\n y[x[i][a][1]]="0"*(6-len(j))+j+"0"*(6-len(k))+k\n cnt+=1\n cnt=1\nprint(x)\nfor i in range(m):\n print(y[i])', 'def compress(arr):\n *XS, = set(arr)\n XS.sort()\n return {e: i+1 for i, e in enumerate(XS)} \nn,m=map(int,input().split())\ns=[[] for i in range(n+1)]\np=[0]*m\ny=[0]*m\nfor i in range(m):\n p[i],y[i]=map(int,input().split())\n s[p[i]].append(y[i])\nfor i in range(1,n+1):\n s[i]=compress(s[i])\nfor i in range(m):\n print("0"*(6-len(str(p[i]))),p[i],"0"*(6-len(str(s[p[i]][y[i]]))),s[p[i]][y[i]],sep="")']
|
['Wrong Answer', 'Accepted']
|
['s521233216', 's561671114']
|
[43964.0, 59052.0]
|
[841.0, 907.0]
|
[398, 412]
|
p03221
|
u227082700
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['def pypri(p,y):print(str(p).zfill(6)+str(y).zfill(6))\nn,m=map(int,input().split())\na=[[]for _ in range(n)]\nb=[]\nfor i in range(m):\n p,y=map(int,input.split())\n b.append(p-1)\n a[p-1].append([y,len(a[p-1])+1])\nfor i in range(n):\n a[i].sort()\n for j in range(len(a[i])):\n a[i][j]=[a[i][j][1],j]\n a.sort()\nfor i in b:\n pypri(i+1,a[i][0][1]+1)\n del a[i][0]', 'n,m=map(int,input().split())\ne=[[]for _ in range(n)]\npy=[]\nfor _ in range(m):\n p,y=map(int,input().split())\n py.append((p,y))\n e[p-1].append(y)\nfor i in range(n):e[i].sort()\nxy=lambda x,y:y*1000000+x\nd={}\nfor i in range(n):\n for j in range(len(e[i])):\n d[xy(i+1,e[i][j])]=str(i+1).zfill(6)+str(j+1).zfill(6)\nfor p,y in py:\n print(d[xy(p,y)])\n']
|
['Runtime Error', 'Accepted']
|
['s259698536', 's523964954']
|
[10292.0, 50108.0]
|
[42.0, 511.0]
|
[364, 350]
|
p03221
|
u227085629
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int,input().split())\npyl = [list(map(int,input().split())) for nesya in range(m)]\npredic = dict()\npyl = sorted(pyl,key = lambda x:x[1])\nfor py in pyl:\n p = py[0]\n if p in predic:\n predic[p] += 1\n else:\n predic[p] = 1\n print((str(p).zfill(6))+(str(predic[p]).zfill(6)))', 'n,m = map(int,input().split())\npyl = [list(map(int,input().split())) for nesya in range(m)]\npredic = dict()\nydic = dict()\nspyl = sorted(pyl,key = lambda x:x[1])\nfor py in spyl:\n p = py[0]\n y = py[1]\n if p in predic:\n predic[p] += 1\n else:\n predic[p] = 1\n ydic[y] = (str(p).zfill(6))+(str(predic[p]).zfill(6))\nfor hoge in pyl:\n print(ydic[hoge[1]])']
|
['Wrong Answer', 'Accepted']
|
['s204971367', 's720398001']
|
[37768.0, 51572.0]
|
[640.0, 675.0]
|
[288, 359]
|
p03221
|
u232852711
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n, m = map(int, input().split())\npy = [list(map(int, input().split())) for _ in range(m)]\n\nans = [0]*m\nprefecs = [1]*(n+1)\nfor i, (p, y) in enumerate(py):\n top = p\n under = prefecs[p]\n ans[i] = str(top).zfill(6)+str(under).zfill(6)\n prefecs[p] += 1\n\nfor i in range(m):\n print(ans[i])\n', 'n, m = map(int, input().split())\npy = [list(map(int, input().split()))+[i+1] for i in range(m)]\npy = sorted(py, key = lambda x: x[1])\n\nans = [0]*m\nprefecs = [1]*(n+1)\nfor i, (p, y, j) in enumerate(py):\n top = p\n under = prefecs[p]\n ans[i] = (str(top).zfill(6)+str(under).zfill(6), j)\n prefecs[p] += 1\n\nans = sorted(ans, key = lambda x: x[1])\nfor i in range(m):\n print(ans[i][0])\n']
|
['Wrong Answer', 'Accepted']
|
['s740578393', 's976021018']
|
[36708.0, 39828.0]
|
[513.0, 754.0]
|
[299, 394]
|
p03221
|
u241159583
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int, input().split())\npy = [list(map(int, input().split())) for _ in range(m)]\npy.sort()\n\nans = []\nb = py[0][0]\ncnt = 0\nfor p,y in py:\n if b == p: cnt += 1\n else:\n b = p\n cnt = 1\n a = [str(p), str(cnt)]\n if len(str(p)) < 6: a[0] = "0"*(6-len(str(p))) + str(p)\n if len(str(cnt)) < 6: a[1] = "0"*(6-len(str(cnt))) + str(cnt)\n ans.append(a[0] + a[1])\nfor v in ans: print(v)', 'n,m = map(int, input().split())\npyi = [list(map(int, input().split())) + [i] for i in range(m)]\npyi.sort()\n\npnow = pyi[0][0]\ncnt = 1\n\nans = [-1 for _ in range(m)]\n\nfor p,y,i in pyi:\n if pnow != p:\n cnt = 1\n pnow = p\n ans[i] = str(p).zfill(6) + str(cnt).zfill(6)\n cnt += 1\nprint("\\n".join(ans))']
|
['Wrong Answer', 'Accepted']
|
['s434512440', 's409481981']
|
[36496.0, 34500.0]
|
[807.0, 637.0]
|
[392, 302]
|
p03221
|
u244459371
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int,input().split())\ncity = [[] for _ in range(n+1)]\nret = ["" for _ in range(m)]\ndef createSix(s):\n while len(s) != 6:\n s = "0" + s\n return s\nfor i in range(m):\n a,b = map(int, input().split())\n city[a].append((b, i))\nfor i in range(m):\n city[i].sort()\nprint(city)\nfor i in range(n+1):\n for j in range(len(city[i])):\n ret[city[i][j][1]] = createSix(str(i)) + createSix(str(j+1))\nfor i in ret:\n print(i)\n \n\n \n', 'n,m = map(int,input().split())\ncity = [[] for _ in range(n+1)]\nret = ["" for _ in range(m)]\ndef createSix(s):\n while len(s) != 6:\n s = "0" + s\n return s\nfor i in range(m):\n a,b = map(int, input().split())\n city[a].append((b, i))\nfor i in range(n+1):\n city[i].sort()\nfor i in range(n+1):\n for j in range(len(city[i])):\n ret[city[i][j][1]] = createSix(str(i)) + createSix(str(j+1))\nfor i in ret:\n print(i)\n']
|
['Runtime Error', 'Accepted']
|
['s409793835', 's359045590']
|
[38044.0, 36016.0]
|
[775.0, 692.0]
|
[460, 439]
|
p03221
|
u252828980
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int,input().split())\nL = []\nfor i in range(m):\n li = list(map(int,input().split()))\n L.append(li)\n\nli = []\nfor i,j in enumerate(L):\n li.append(j+[i])\nli.sort()\n\ni = 1\nans = []\nwhile i <= n:\n l = []\n for j in range(m):\n if li[j][0] == i:\n l.append(li[j])\n l.sort(key = lambda x:x[1])\n for k,v in enumerate(l):\n l[k][1] = k+1\n ans += l\n i +=1\nans.sort(key = lambda x:x[2])\n\nfor i in range(m):\n print("{:06d}".format(ans[i][0]),"{:06d}".format(ans[i][1]))\n', 'n,m = map(int,input().split())\nL = []\nfor i in range(m):\n li = list(map(int,input().split()))\n L.append(li)\n\nli = []\nfor i,j in enumerate(L):\n li.append(j+[i])\nli.sort(key = lambda x:(x[0],x[1]))\n\nli.append([0,0,0])\n\nk,r = li[0][0],1\nfor i in range(m):\n if li[i][0] == k:\n if li[i+1][1] == li[i][1]:\n li[i][1] = r\n li[i+1][1] = r\n else:\n li[i][1] = r\n r +=1\n else:\n k = li[i][0]\n r = 1\n li[i][1] = r\n r +=1\n\nli.pop()\n\nli.sort(key = lambda x:x[2])\n\nfor i in range(m):\n print("{:06d}".format(li[i][0])+"{:06d}".format(li[i][1]))']
|
['Wrong Answer', 'Accepted']
|
['s994960146', 's829149611']
|
[43624.0, 49660.0]
|
[2206.0, 620.0]
|
[518, 630]
|
p03221
|
u253681061
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = [int(x) for x in input().split()]\npy = []\nfor i in range(m):\n p,y = [int(x) for x in input().split()]\n py.append([p,y,i+1])\n\ndef zero(num):\n return str(num).zfill(6)\n\n\nif m == 1:\n print(zero(py[0])+zero(1))\nelse:\n year_py = sorted(py, key=lambda x: x[1])\n dic = {x: 0 for x in range(1,m+1)}\n\n \n \n # year_py[i].append(dic[year_py[i][0]])\n \n\n \n ', 'n,m = [int(x) for x in input().split()]\npy = []\nfor i in range(m):\n p,y = [int(x) for x in input().split()]\n py.append([p,y,i+1])\n\ndef zero(num):\n return str(num).zfill(6)\n\n\nif m == 1:\n print(zero(py[0])+zero(1))\nelse:\n year_py = sorted(py, key=lambda x: x[1])\n dic = {x: 0 for x in range(1,m+1)}\n\n for i in range(m):\n dic[year_py[i][0]] += 1\n year_py[i].append(dic[year_py[i][0]])\n yb_py = sorted(year_py, key=lambda x: x[2])\n\n \n ', 'n,m = [int(x) for x in input().split()]\npy = []\nfor i in range(m):\n p,y = [int(x) for x in input().split()]\n py.append([p,y,i+1])\n\ndef zero(num):\n return str(num).zfill(6)\n\n\nif m == 1:\n print(zero(py[0][0])+zero(1))\nelse:\n year_py = sorted(py, key=lambda x: x[1])\n dic = {str(x): 0 for x in range(1,n+1)}\n\n for i in range(m):\n dic[str(year_py[i][0])] += 1\n year_py[i].append(dic[str(year_py[i][0])])\n yb_py = sorted(year_py, key=lambda x: x[2])\n\n for i in range(m):\n print(zero(yb_py[i][0]) + zero(yb_py[i][3]))']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s813217941', 's854104342', 's815213758']
|
[35624.0, 41980.0, 45620.0]
|
[497.0, 660.0, 892.0]
|
[547, 543, 559]
|
p03221
|
u253759478
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["import bisect\n\nn, m = [int(_) for _ in input().split(' ')]\n\np, y = [], []\nfor _ in range(m):\n temp = [int(_) for _ in input().split(' ')]\n p.append(temp[0])\n y.append(temp[1])\nys = dict()\nfor i in range(m):\n if not(p[i] in ys):\n ys[p[i]] = []\n ys[p[i]].append(y[i])\n\nfor j in ys.keys():\n ys[j].sort()\n\nprint(ys)\n\nfor i in range(m):\n print('{0}{1}'.format(str(p[i]).zfill(6), str(bisect.bisect(ys[p[i]], y[i])).zfill(6)))\n", "import bisect\n\nn, m = [int(_) for _ in input().split(' ')]\n\np, y = [], []\nfor _ in range(m):\n temp = [int(_) for _ in input().split(' ')]\n p.append(temp[0])\n y.append(temp[1])\nys = dict()\nfor i in range(m):\n if not(p[i] in ys):\n ys[p[i]] = []\n ys[p[i]].append(y[i])\n\nfor j in ys.keys():\n ys[j].sort()\n\nfor i in range(m):\n print('{0}{1}'.format(str(p[i]).zfill(6), str(bisect.bisect(ys[p[i]], y[i])).zfill(6)))\n"]
|
['Wrong Answer', 'Accepted']
|
['s087057566', 's167185706']
|
[35084.0, 29736.0]
|
[715.0, 646.0]
|
[449, 438]
|
p03221
|
u254871849
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["import sys\n\ndef fill(s): while len(s) < 6: s = '0' + s; return s\ndef create_id(p, o): return fill(str(p)) + fill(str(o))\n\nn, m, *py = map(int, sys.stdin.read().split())\npyi = sorted(zip(zip(*[iter(py)] * 2), range(m)))\n\ndef main():\n res = [None] * m\n prev = j = None\n for (p, y), i in pyi:\n j = j + 1 if p == prev else 1\n res[i] = create_id(p, j)\n prev = p\n print(*res, sep='\\n')\n \nif __name__ == '__main__':\n main()", "import sys\n\ndef fill(s): return '0' * (6 - len(s)) + s\ndef create_id(p, o): return fill(str(p)) + fill(str(o))\n\nn, m, *py = map(int, sys.stdin.read().split())\npyi = sorted(zip(*[iter(py)] * 2 + [range(m)]))\n\ndef main():\n res = [None] * m\n prev = j = None\n for p, y, i in pyi:\n j = j + 1 if p == prev else 1\n res[i] = create_id(p, j)\n prev = p\n print(*res, sep='\\n')\n \nif __name__ == '__main__':\n main()"]
|
['Runtime Error', 'Accepted']
|
['s354814385', 's688473171']
|
[2940.0, 32208.0]
|
[17.0, 348.0]
|
[456, 442]
|
p03221
|
u263830634
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["import sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\n\nlst = [list(map(int, input().split())) + [i] for i in range(M)]\nprint (lst)\n\nlst.sort(key = lambda x: x[1]) \nlst.sort(key = lambda x: x[0])\n\n\nans = [0] * M\n\ncount = 0\ntmp = 0 \nfor p, y, i in lst:\n if tmp == p:\n count += 1\n else:\n count = 1\n tmp = p\n tmp_ans = str(p).zfill(6) + str(count).zfill(6)\n ans[i] = tmp_ans\n\nprint (*ans, sep = '\\n')\n\n\n\n", "N, M = map(int, input().split())\n\nlst = []\nfor i in range(M):\n a = list(map(int, input().split()))\n lst += [a]\n\n#print (lst)\nlst.sort()\n#print (lst)\n\nken = -1\nx = 0\nfor j in range(M):\n if ken != lst[j][0]: \n x = 1 #\n ken = lst[j][0]\n P = '{:0>6}'.format(ken)\n else: \n x += 1\n X = '{:0>6}'.format(x)\n ans = P + X\n print (ans)", "import sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\n\nlst = [list(map(int, input().split())) + [i] for i in range(M)]\n# print (lst)\n\nlst.sort(key = lambda x: x[1]) \nlst.sort(key = lambda x: x[0])\n\n\nans = [0] * M\n\ncount = 0\ntmp = 0 \nfor p, y, i in lst:\n if tmp == p:\n count += 1\n else:\n count = 1\n tmp = p\n tmp_ans = str(p).zfill(6) + str(count).zfill(6)\n ans[i] = tmp_ans\n\nprint (*ans, sep = '\\n')\n\n\n\n"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s236589735', 's393696109', 's331144380']
|
[36016.0, 28776.0, 33308.0]
|
[654.0, 750.0, 569.0]
|
[511, 437, 513]
|
p03221
|
u268554510
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N,M=map(int,input().split())\nPY=[list(map(int,input().split())) for _ in range(M)]\nPY.sort(key=lambda x:x[1])\nflag=[1]*N\nans=[]\nfor P,Y in PY:\n ans.append(str(P).zfill(6)+str(flag[P-1]).zfill(6))\n flag[P-1]+=1\n \nans.sort\nfor a in ans:\n print(a)', 'N,M=map(int,input().split())\nPY=[list(map(int,input().split())) for _ in range(M)]\nidx=sorted(range(M),key=lambda x:PY[x][1])\nPY.sort(key=lambda x:x[1])\nflag=[1]*N\nkeep=[]\nfor P,Y in PY:\n keep.append(str(P).zfill(6)+str(flag[P-1]).zfill(6))\n flag[P-1]+=1\n \nans=[0]*M\nfor i,k in zip(idx,keep):\n ans[i]=k\n \nfor a in ans:\n print(a)']
|
['Wrong Answer', 'Accepted']
|
['s086133230', 's854391743']
|
[36864.0, 41448.0]
|
[614.0, 711.0]
|
[248, 334]
|
p03221
|
u269623316
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\ndict1={}\ndict2={}\nfor i in range(m):\n x,y=map(int,input().split())\n try:\n dict1[x].append([y,i+1])\n except:\n KeyError\n dict1[x]=[[y,i+1]]\nansarr=["0"]*m\nfor i in dict1.keys():\n dict1[i].sort()\n s1=(6-len(str(i)))*\'0\'+str(i)\n for j in range(len(dict1[i])):\n s2=(6-len(str(j+1)))*\'0\'+str(j+1)\n print(dict1[i][j][1])\n ansarr[dict1[i][j][1]-1]=s1+s2\nfor i in range(m):\n print(ansarr[i])', 'n,m=map(int,input().split())\ndict1={}\ndict2={}\nfor i in range(m):\n x,y=map(int,input().split())\n try:\n dict1[x].append([y,i+1])\n except:\n KeyError\n dict1[x]=[[y,i+1]]\nansarr=["0"]*m\nfor i in dict1.keys():\n dict1[i].sort()\n s1=(6-len(str(i)))*\'0\'+str(i)\n for j in range(len(dict1[i])):\n s2=(6-len(str(j+1)))*\'0\'+str(j+1)\n #print(dict1[i][j][1])\n ansarr[dict1[i][j][1]-1]=s1+s2\nfor i in range(m):\n print(ansarr[i])']
|
['Wrong Answer', 'Accepted']
|
['s356026020', 's004820772']
|
[46776.0, 46008.0]
|
[921.0, 789.0]
|
[474, 475]
|
p03221
|
u272557899
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['import copy\nn, m = map(int, input().split())\ns = []\nfor i in range(m):\n s.append([int(i) for i in input().split()])\n #l2 = l[:]\nt = s[:]\nt.sort()\nt.sort(key=lambda x: x[1])\nco = 1\nfor i in range(m):\n if i != 0:\n if t[i][0] != t[i - 1][0]:\n co = 1\n if t[i][0] <10:\n moji1 = "00000" + str(t[i][0])\n elif t[i][0] <100:\n moji1 = "0000" + str(t[i][0])\n elif t[i][0] <1000:\n moji1 = "000" + str(t[i][0])\n elif t[i][0] <10000:\n moji1 = "00" + str(t[i][0])\n elif t[i][0] <100000:\n moji1 = "0" + str(t[i][0])\n else:\n moji1 = str(t[i][0])\n\n if co <10:\n moji2 = "00000" + str(co)\n elif co <100:\n moji2 = "0000" + str(co)\n elif co <1000:\n moji2 = "000" + str(co)\n elif co <10000:\n moji2 = "00" + str(co)\n elif co <100000:\n moji2 = "0" + str(co)\n else:\n moji2 = str(co)\n t[i].append(moji1 + moji2)\n\nfor i in range(m):\n print(s[i][2])', 'import copy\nn, m = map(int, input().split())\ns = []\nfor i in range(m):\n s.append([int(i) for i in input().split()])\n #l2 = l[:]\nt = s[:]\nt.sort()\nt.sort(key=lambda x:(x[0], x[1]))\nco = 1\nfor i in range(m):\n if i != 0:\n if t[i][0] != t[i - 1][0]:\n co = 1\n if t[i][0] <10:\n moji1 = "00000" + str(t[i][0])\n elif t[i][0] <100:\n moji1 = "0000" + str(t[i][0])\n elif t[i][0] <1000:\n moji1 = "000" + str(t[i][0])\n elif t[i][0] <10000:\n moji1 = "00" + str(t[i][0])\n elif t[i][0] <100000:\n moji1 = "0" + str(t[i][0])\n else:\n moji1 = str(t[i][0])\n\n if co <10:\n moji2 = "00000" + str(co)\n elif co <100:\n moji2 = "0000" + str(co)\n elif co <1000:\n moji2 = "000" + str(co)\n elif co <10000:\n moji2 = "00" + str(co)\n elif co <100000:\n moji2 = "0" + str(co)\n else:\n moji2 = str(co)\n t[i].append(moji1 + moji2)\n co += 1\n\nfor i in range(m):\n print(s[i][2])\n\n']
|
['Wrong Answer', 'Accepted']
|
['s673634799', 's414195833']
|
[30476.0, 30360.0]
|
[794.0, 790.0]
|
[982, 1003]
|
p03221
|
u273201018
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["from itertools import chain\n\n\nN, M = map(int, input().split())\n\nP = [0] * N\n\nI = list(range(M))\n\nQ = [None] * M\nY = [None] * M\n\nfor m in range(M):\n Q[m], Y[m] = map(int, input().split())\n P[Q[m]-1] += 1\n\nD = zip(I, Q, Y)\nD = sorted(D, key=lambda x: [x[1], x[2]])\nI, Q, Y = map(list, zip(*D))\n\nprint(P)\n\nP = list(chain.from_iterable([list(range(1, p+1)) for p in P]))\n\nprint(P)\n\nD = zip(I, Q, Y, P)\nD = sorted(D, key=lambda x: x[0])\nI, Q, Y, P = map(list, zip(*D))\n\nprint(P)\n\nfor i in range(M):\n print('%06d%06d' % (Q[i], P[i]))\n", "from itertools import chain\nimport numpy as np\nimport pandas as pd\n\n\nN, M = map(int, input().split())\n\nP = [0] * N\n\nI = list(range(M))\n\nQ = [None] * M\nY = [None] * M\n\nfor m in range(M):\n Q[m], Y[m] = map(int, input().split())\n P[Q[m]-1] += 1\n\nD = zip(I, Q, Y)\nD = sorted(D, key=lambda x: [x[1], x[2]])\nI, Q, Y = map(list, zip(*D))\n\nprint(P)\n\nP = list(chain.from_iterable([list(range(1, p+1)) for p in P]))\n\nprint(P)\n\nD = zip(I, Q, Y, P)\nD = sorted(D, key=lambda x: x[0])\nI, Q, Y, P = map(list, zip(*D))\n\nprint(P)\n\nfor i in range(M):\n print('%06d%06d' % (Q[i], P[i]))\n", "from itertools import chain\n\n\nN, M = map(int, input().split())\n\nP = [0] * N\n\nI = list(range(M))\n\nQ = [None] * M\nY = [None] * M\n\nfor m in range(M):\n Q[m], Y[m] = map(int, input().split())\n P[Q[m]-1] += 1\n\nD = zip(I, Q, Y)\nD = sorted(D, key=lambda x: [x[1], x[2]])\nI, Q, Y = map(list, zip(*D))\n\nP = list(chain.from_iterable([list(range(1, p+1)) for p in P]))\n\nD = zip(I, Q, Y, P)\nD = sorted(D, key=lambda x: x[0])\nI, Q, Y, P = map(list, zip(*D))\n\nfor i in range(M):\n print('%06d%06d' % (Q[i], P[i]))\n"]
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s339712245', 's994420291', 's220993918']
|
[40672.0, 13360.0, 39648.0]
|
[929.0, 149.0, 953.0]
|
[537, 576, 507]
|
p03221
|
u277641173
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m=map(int,input().split())\nlis=[]\nfor i in range(m):\n p,q=map(int,input().split())\n lis.append([q,p])\nlis.sort()\nken=[1]*n\nfor i in range(0,m):\n attack=lis[i]\n kenken=attack[1]\n ken_count=ken[kenken-1]\n moji=""\n moji+="0"*(6-len(str(kenken)))+str(kenken)+"0"*(6-len(str(ken_count)))+str(ken_count)\n ken[kenken-1]+=1\n print(moji)', 'n,m=map(int,input().split())\nlis=[]\nfor i in range(0,m):\n p,q=map(int,input().split())\n lis.append([q,p,i])\nlis.sort()\nken=[1]*n\nres=[]\nfor i in range(0,m):\n attack=lis[i]\n kenken=attack[1]\n ken_count=ken[kenken-1]\n moji=""\n moji+="0"*(6-len(str(kenken)))+str(kenken)+"0"*(6-len(str(ken_count)))+str(ken_count)\n ken[kenken-1]+=1\n res.append([attack[2],moji])\n \nres.sort()\nfor i in range(0,m):\n print(res[i][1])\n\n\n\n']
|
['Wrong Answer', 'Accepted']
|
['s456880093', 's641872052']
|
[21760.0, 41884.0]
|
[715.0, 965.0]
|
[339, 454]
|
p03221
|
u278057806
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['from sys import stdin\n\nN, M = map(int, stdin.readline().split())\npy = [list(map(int, stdin.readline().split())) for _ in range(M)]\n\npy.sort()\n\npx = []\n\nptmp = 0\nxtmp = 1\n\nfor p, y in py:\n if p == ptmp:\n xtmp += 1\n px.append([p, xtmp])\n else:\n ptmp = p\n xtmp = 1\n px.append([p, xtmp])\n\nfor p, x in px:\n print("{0:06d}".format(p), "{0:06d}".format(x), sep="")\n', 'from sys import stdin\n\nN, M = map(int, stdin.readline().split())\npy = [list(map(int, stdin.readline().split())) for _ in range(M)]\n\nfor i in range(M):\n py[i].append(i)\n\npy.sort()\n\npx = []\n\nptmp = 0\nxtmp = 1\n\nfor p, y, i in py:\n if p == ptmp:\n xtmp += 1\n else:\n ptmp = p\n xtmp = 1\n px.append([str(p).zfill(6) + str(xtmp).zfill(6), i])\n\n\npx.sort(key=lambda x: x[1])\n\nfor out, i in px:\n print(out)\n']
|
['Wrong Answer', 'Accepted']
|
['s613275535', 's500044058']
|
[39404.0, 45980.0]
|
[665.0, 681.0]
|
[402, 431]
|
p03221
|
u281610856
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\narr = [0 for _ in range(M)]\nfor i in range(M):\n p, y = map(int, input().split())\n arr[i] = [p, y, i]\nprint(arr)\narr.sort(key=lambda x:x[1])\nprint(arr)\narr[0][1] = 1\nans_list = [0] * M\nfor i in range(0, M):\n if i == 0:\n ans_list[i] = [str(arr[0][0]).zfill(6) + str(arr[0][1]).zfill(6), arr[i][2]]\n continue\n if arr[i][0] == arr[i - 1][0]:\n arr[i][1] = arr[i - 1][1] + 1\n else:\n arr[i][1] = 1\n ans_list[i] = [str(arr[i][0]).zfill(6) + str(arr[i][1]).zfill(6), arr[i][2]]\nprint(ans_list)\nans_list.sort(key=lambda x:x[1])\nfor i in range(M):\n print(ans_list[i][0])', 'N, M = map(int, input().split())\narr = [0 for _ in range(M)]\nfor i in range(M):\n arr[i] = list(map(int, input().split()))\narr_sort = sorted(arr)\n\narr_sort[0][1] = 1\nfor i in range(0, M):\n if i == 0:\n print(str(arr_sort[0][0]).zfill(6) + str(arr_sort[0][1]).zfill(6))\n continue\n if arr_sort[i][0] == arr_sort[i - 1][0]:\n arr_sort[i][1] = arr_sort[i - 1][1] + 1\n else:\n arr_sort[i][1] = 1\n print(str(arr_sort[i][0]).zfill(6) + str(arr_sort[i][1]).zfill(6))', 'N, M = map(int, input().split())\narr = [0 for _ in range(M)]\nfor i in range(M):\n p, y = map(int, input().split())\n arr[i] = [p, y, i]\n\narr.sort(key=lambda x: x[1])\n\narr[0][1] = 1\nP_cnt = [1 for _ in range(10 ** 6)]\nans_list = [0] * M\nfor p, y, i in arr:\n ans_list[i] = [str(p).zfill(6) + str(P_cnt[p]).zfill(6), i]\n P_cnt[p] += 1\n\nans_list.sort(key=lambda x: x[1])\nfor i in range(M):\n print(ans_list[i][0])']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s136059201', 's680618780', 's275204423']
|
[54552.0, 29596.0, 49252.0]
|
[1020.0, 734.0, 823.0]
|
[641, 497, 421]
|
p03221
|
u282228874
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int,input().split())\nP = [list(map(int,input().split()))+[0] for i in range(m)]\nX = sorted(P,key = lambda x:x[1])\ncity = {}\nfor p,y,z in X:\n if p in city:\n city[p] += 1\n else:\n city[p] = 1\n z = city[p]\nfor p,y,z in P:\n print(str(p).zfill(6)+str(z).zfill(6))\n', 'N,M = map(int,input().split())\nA = []\nfor i in range(M):\n p,y = map(int,input().split())\n A.append([p,y,i,0])\nA.sort(key = lambda x:x[1])\nD = dict()\nfor a in A:\n if a[0] not in D:\n D[a[0]] = 1\n else:\n D[a[0]] += 1\n a[3] = D[a[0]]\nA.sort(key=lambda x:x[2])\nfor a in A:\n print(str(a[0]).zfill(6)+str(a[3]).zfill(6))\n']
|
['Wrong Answer', 'Accepted']
|
['s742479017', 's143347801']
|
[30096.0, 33620.0]
|
[610.0, 666.0]
|
[294, 346]
|
p03221
|
u283719735
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["n, m = [int(x) for x in input().split(' ')]\n\ncities = list()\nfor i in range(m):\n pi, pm = [int(x) for x in input().split(' ')]\n cities.append((pi, pm))\n\np = [0] * (n+1)\nfor city in sorted(cities, key=lambda city: city[1]): # sort by year\n p[city[0]] += 1 # city birth order\n print('{:06d}{:06d}'.format(city[0], p[city[0]]))\n", "n, m = [int(x) for x in input().split(' ')]\n\ncities = list()\nfor i in range(m):\n pi, pm = [int(x) for x in input().split(' ')]\n cities.append([pi, pm, i])\n\np = [0] * (n+1)\nfor c in sorted(cities, key=lambda city: city[1]): # sort by year\n p[c[0]] += 1 # city birth order\n c.append(p[c[0]])\n\nfor c in cities:\n print('{:06d}{:06d}'.format(c[0], c[3]))\n"]
|
['Wrong Answer', 'Accepted']
|
['s487436220', 's341675588']
|
[19792.0, 31596.0]
|
[576.0, 631.0]
|
[337, 365]
|
p03221
|
u284363684
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['# input\nN, M = map(int, input().split())\n\ncitys = []\nc_append = citys.append\nprefs = []\np_append = prefs.append\npref_in_citys = {}\nfor i in range(M):\n P, Y = map(int, input().split())\n if P not in prefs:\n p_append(P)\n pref_in_citys[P] = []\n city_dict = {\n "birth": Y,\n "pref": P,\n "number": ""\n }\n c_append(city_dict)\n pref_in_citys[P].append(citys[-1])\n\n\nfor p in pref_in_citys.keys():\n target_citys = pref_in_citys[p]\n if len(target_citys) == 1:\n target_citys[0]["number"] += "000001"\n else:\n target_citys.sort(key=lambda x: x["birth"])\n lot_num = 1\n for c in target_citys:\n c["number"] += "0" * (6 - len(str(p))) + str(p) + "0" * (6 - len(str(lot_num))) + str(lot_num)\n lot_num += 1\n\nfor c in citys:\n print(c["number"])', 'N, M = map(int, input().split())\npiys = [[] for _ in range(N)]\nfor i in range(M):\n p, y = map(int, input().split())\n piys[p-1].append((y, i))\n\nans = [None]*M\nfor p, iys in enumerate(piys):\n iys.sort()\n for k, (y, i) in enumerate(iys):\n ans[i] = "%06d%06d" % (p+1, k+1)\n\nfor i in ans:\n print(i)']
|
['Wrong Answer', 'Accepted']
|
['s220422305', 's397430583']
|
[48496.0, 35920.0]
|
[2105.0, 581.0]
|
[844, 315]
|
p03221
|
u288087195
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['# -*- coding: utf-8 -*-\nfrom operator import itemgetter\n\nN, M = list(map(int, input().split()))\nA = [[0] * 4 for i in range(M)]\nfor i in range(M):\n A[i][0], A[i][1] = list(map(int, input().split()))\n A[i][2] = i\n\nsorted_A = sorted(A, key=itemgetter(1))\nprint(sorted_A)\n\nP_num = [1]*N\nfor a in sorted_A:\n y = a[0]\n a[3] = P_num[y-1]\n P_num[y-1] += 1\n\nprint(sorted_A)\nB = sorted(sorted_A, key=itemgetter(2))\nfor b in B:\n print("%06d%06d" % (b[0], b[3]))\n', '# -*- coding: utf-8 -*-\nfrom operator import itemgetter\n\nN, M = list(map(int, input().split()))\nA = [[0] * 4 for i in range(M)]\nP = []\nfor i, a in enumerate(A):\n a[0], a[1] = list(map(int, input().split()))\n a[2] = i\n if not a[0] in P:\n P.append(a[0])\n\nP_counts = [0]*len(P)\nsorted_A = sorted(A, key=itemgetter(1))\n\nfor a in sorted_A:\n idx = P.index(a[0])\n P_counts[idx] += 1\n print(str(a[0]).zfill(6) + str(P_counts[idx]).zfill(6))\n', '# -*- coding: utf-8 -*-\nfrom operator import itemgetter\n\nN, M = list(map(int, input().split()))\nA = [[0] * 4 for i in range(M)]\nfor i in range(M):\n A[i][0], A[i][1] = list(map(int, input().split()))\n A[i][2] = i\n\nsorted_A = sorted(A, key=itemgetter(1))\n\nP_num = [1]*N\nfor a in sorted_A:\n y = a[0]\n a[3] = P_num[y-1]\n P_num[y-1] += 1\n\nB = sorted(sorted_A, key=itemgetter(2))\nfor b in B:\n print("%06d%06d" % (b[0], b[3]))\n']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s643055329', 's996224040', 's067709172']
|
[42256.0, 26920.0, 31372.0]
|
[858.0, 2105.0, 685.0]
|
[470, 458, 438]
|
p03221
|
u290443463
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N,M = map(int,input().split())\nP=[map(int,input().split()) for _ in range(M)]\nd = {}\nfor p,y in P:\n if p not in d:\n d[p]=[]\n d[p].append(y)\nsd = {k:dict(zip(sorted(v),range(1,1+len(v))))\n for k,v in d.items()}\nfor p,y in P:\n print('%06d%06d' % (p, sd[p][y]))", "N,M = map(int,input().split())\nP=[]\nfor _ in range(M):\n p,y = map(int,input().split())\n P.append((p,y))\nd = {}\nfor p,y in P:\n if p not in d:\n d[p]=[]\n d[p].append(y)\nsd = {k:dict(zip(sorted(v),range(1,1+len(v))))\n for k,v in d.items()}\nfor p,y in P:\n print('%06d%06d' % (p, sd[p][y]))\n"]
|
['Runtime Error', 'Accepted']
|
['s750451081', 's961143229']
|
[85600.0, 70916.0]
|
[810.0, 806.0]
|
[269, 298]
|
p03221
|
u294000907
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nn,m = map(int, input().split())\npl =[1]*(n+1)\n\na=[]\nfor i in range(0,m):\n p,l = map(int, input().split())\n s='{:06}{:06}'.format(p,pl[p])\n pl[p]=pl[p]+1\n a.append(s)\na.sort()\nfor i in range(0,m):\n print(a[i])\n", '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nn,m = map(int, input().split())\npp =[1]*(n+1)\n\npl =[1]*(m)\nmm={}\n\nfor i in range(0,m):\n p,l = map(int, input().split())\n pl[i]=p\n mm[i]=p*100000+l\na=[""]*(m+1)\nfor k, v in sorted(mm.items(), key=lambda x: x[1]):\n pre=pl[k]\n a[k]="{:06}{:06}".format(pl[k],pp[pre])\n pp[pre]=pp[pre]+1\nfor i in range(0,m):\n print(a[i])\n']
|
['Wrong Answer', 'Accepted']
|
['s439891974', 's472176340']
|
[12336.0, 38104.0]
|
[584.0, 644.0]
|
[261, 371]
|
p03221
|
u298297089
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['from heapq import heappush\nN,M = map(int, input().split())\nA = {}\nprefs = []\nyears = []\nfor i in range(M):\n p,y = input().split()\n prefs.append(p)\n years.append(y)\n if p not in A:\n A[p] = [y]\n else:\n heappush(A[p], y)\nres = {}\nfor k,v in A.items():\n for i in range(len(v)):\n res[k+v[i]] = str(i+1)\nfor p,y in zip(prefs, years):\n print(p.zfill(6) + res[k+y].zfill(6))\n', 'n,m = map(int, input().split())\npre = {}\ncity = []\nfor i in range(m):\n p,y = map(int, input().split())\n if p not in pre:\n pre[p] = []\n pre[p].append(y)\n city.append((p,y))\n\nd = {}\nfor k in pre.keys():\n pre[k].sort()\n for i in range(len(pre[k])):\n d[(k, pre[k][i])] = i+1\n\nfor p,y in city:\n print(str(p).zfill(6) + str(d[(p, y)]).zfill(6))\n ']
|
['Runtime Error', 'Accepted']
|
['s372942738', 's099772694']
|
[56988.0, 53700.0]
|
[470.0, 800.0]
|
[409, 378]
|
p03221
|
u302292660
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['n,m = map(int,input().split())\ninl = [[i] + list(map(int,input().split())) for i in range(m)]\ninl = sorted(inl,key=lambda x:x[1])\ninl = sorted(inl,key=lambda x:x[2])\ncnt = 1\nprint(inl)\nfor i in range(m):\n a = str(inl[i][1]).rjust(6,"0")\n b = str(cnt).rjust(6,"0")\n cnt +=1\n if i !=m-1 and inl[i][1] != inl[i+1][1]:\n cnt = 1\n inl[i][1] = a\n inl[i][2] = b\ninl = sorted(inl,key=lambda x:x[0])\nfor i in range(m):\n print(str(inl[i][1])+str(inl[i][2]))', 'n,m = map(int,input().split())\ninl = [[i] + list(map(int,input().split())) for i in range(m)]\ninl = sorted(inl,key=lambda x:x[1])\ninl = sorted(inl,key=lambda x:x[2])\ncnt = 1\nfor i in range(m):\n inl[i][1] = str(inl[i][1]).rjust(6,"0")\n inl[i][2] = str(cnt).rjust(6,"0")\n cnt +=1\n if i!=m-1 and inl[i][1] != inl[i+1][1]:\n cnt = 1\n\ninl = sorted(inl,key=lambda x:x[0])\nfor i in range(m):\n print(str(inl[i][1])+str(inl[i][2]))', 'n,m = map(int,input().split())\ninl = [[i] + list(map(int,input().split())) for i in range(m)]\ninl = sorted(inl,key=lambda x:x[1])\ninl = sorted(inl,key=lambda x:x[2])\nshi = 1\ncnt = 1\nfor i in range(m):\n if inl[i][1] == shi:\n inl[i][1] = str(shi).rjust(6,"0")\n inl[i][2] = str(cnt).rjust(6,"0")\n cnt +=1\n else:\n shi +=1\n cnt = 1\n inl[i][1] = str(shi).rjust(6,"0")\n inl[i][2] = str(cnt).rjust(6,"0")\n cnt +=1\ninl = sorted(inl,key=lambda x:x[0])\nprint(inl)\nfor i in range(m):\n print(str(inl[i][1])+str(inl[i][2]))', 'n,m = map(int,input().split())\ninl = [[i] + list(map(int,input().split())) for i in range(m)]\ninl = sorted(inl,key=lambda x:x[2])\ninl = sorted(inl,key=lambda x:x[1])\ncnt = 1\nfor i in range(m):\n a = str(inl[i][1]).rjust(6,"0")\n b = str(cnt).rjust(6,"0")\n cnt +=1\n if i !=m-1 and inl[i][1] != inl[i+1][1]:\n cnt = 1\n inl[i][1] = a\n inl[i][2] = b\ninl = sorted(inl,key=lambda x:x[0])\nfor i in range(m):\n print(str(inl[i][1])+str(inl[i][2]))']
|
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s041901558', 's175483597', 's321532164', 's811920139']
|
[39908.0, 37220.0, 44316.0, 37144.0]
|
[965.0, 935.0, 918.0, 879.0]
|
[474, 444, 574, 463]
|
p03221
|
u305018585
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["n,m = map( int, input().split())\n input_list = [[] for i in range(n)]\n\nfor i in range(m):\n p,y = map(int, input().split())\n input_list[p-1].append((y,i))\n \nfor i in input_list :\n i.sort()\n\nresult = [None]*m\n\nfor p,i in enumerate(input_list) :\n for n, (a,b) in enumerate(i):\n result[b] = str(p+1).zfill(6)+str(n+1).zfill(6)\n \nprint(*result, sep = '\\n')", "n,m = map( int, input().split())\n \nresult= {}\ninput_list = [[] for i in range(n)]\n\n\nfor i in range(m):\n p,y = map(int, input().split())\n input_list[p-1].append((y,i))\n \nfor i in input_list :\n i.sort()\n\nresult = [None]*m\n\nfor p,i in enumerate(input_list) :\n for n, (a,b) in enumerate(i):\n result[b] = str(p+1).zfill(6)+str(n+1).zfill(6)\n \nprint(*result, sep = '\\n')\n"]
|
['Runtime Error', 'Accepted']
|
['s198318968', 's502261641']
|
[2940.0, 37480.0]
|
[17.0, 639.0]
|
[363, 377]
|
p03221
|
u305965165
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = (int(i) for i in input().split())\ninput_list = [[int(i) for i in input().split()] for i in range(M)] \n\nm_list = [[] for j in range(N)]\n\nfor inputs in input_list:\n m_list[inputs[0]-1].append(inputs[1])\n\nprint(m_list)\nfor arr in m_list:\n arr.sort()\n\nprint(m_list)\n\nfor inputs in input_list:\n num = m_list[inputs[0]-1].index(inputs[1]) + 1\n print(str(inputs[0]).zfill(6) + str(num).zfill(6))', 'import sys\ninput = sys.stdin.readline\n \nN, M = (int(i) for i in input().split())\ninput_list = [[int(i) for i in input().split()] for i in range(M)] \n \nm_list = [[] for j in range(N+1)]\n \nfor inputs in input_list:\n m_list[inputs[0]].append(inputs[1])\n \nfor arr in m_list:\n arr.sort()\n arr.insert(-10000)\n \nfor inputs in input_list:\n num = m_list[inputs[0]].index(inputs[1])\n print(str(inputs[0]).zfill(6) + str(num).zfill(6))', 'import sys\ninput = sys.stdin.readline\n \nN, M = (int(i) for i in input().split())\npy_list = [[int(i) for i in input().split()] + [0] for i in range(M)] \nm_list = [[] for j in range(N+1)]\n \nsorted_py_list = sorted(py_list, key=lambda x:x[1])\n\ncity_list = {}\nfor py in sorted_py_list:\n city_list[py[0]] = city_list[py[0]]+1 if py[0] in city_list else 1\n py[2] = city_list[py[0]]\n \nfor py in py_list:\n print(str(py[0]).zfill(6) + str(py[2]).zfill(6))']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s243036443', 's332853800', 's251946703']
|
[39200.0, 32832.0, 36736.0]
|
[2105.0, 258.0, 505.0]
|
[407, 439, 455]
|
p03221
|
u309977459
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["import bisect\nn, m = map(int, input().split())\np = []\ny = []\npy = []\ncategorized = [[] for i in range(n+1)]\nfor i in range(m):\n tmpp, tmpy = map(int, input().split())\n p.append(tmpp)\n y.append(tmpy)\n categorized[tmpp].append(tmpy)\n\nfor c in categorized:\n c.sort()\nprint(categorized)\nfor i in range(m):\n order = bisect.bisect(categorized[p[i]], y[i])\n print('%06d%06d' % (p[i], order))\n", "import bisect\nn, m = map(int, input().split())\np = []\ny = []\npy = []\ncategorized = [[] for i in range(n+1)]\nfor i in range(m):\n tmpp, tmpy = map(int, input().split())\n p.append(tmpp)\n y.append(tmpy)\n categorized[tmpp].append(tmpy)\n\nfor c in categorized:\n c.sort()\nfor i in range(m):\n order = bisect.bisect(categorized[p[i]], y[i])\n print('%06d%06d' % (p[i], order))\n"]
|
['Wrong Answer', 'Accepted']
|
['s927731595', 's586267273']
|
[26416.0, 24116.0]
|
[624.0, 612.0]
|
[406, 387]
|
p03221
|
u310233294
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\nPY = [list(map(int, input().split())) + [i] for i in range(M)]\nPY.sort(key=lambda x: [x[0], x[1]])\nans = []\nP = [0] * (N + 1)\nfor p, y, i in PY:\n P[p] += 1\n tmp = str(p).zfill(8) + str(P[p]).zfill(8)\n ans.append([i, tmp])\nans.sort()\nfor i, a in ans:\n print(a)', 'N, M = map(int, input().split())\nPY = [list(map(int, input().split())) + [i] for i in range(M)]\nPY.sort(key=lambda x: [x[0], x[1]])\nans = []\nP = [0] * (N + 1)\nfor p, y, i in PY:\n P[p] += 1\n tmp = str(p).zfill(6) + str(P[p]).zfill(6)\n ans.append([i, tmp])\nans.sort()\nfor i, a in ans:\n print(a)']
|
['Wrong Answer', 'Accepted']
|
['s655963357', 's801027598']
|
[45432.0, 42248.0]
|
[944.0, 1093.0]
|
[304, 304]
|
p03221
|
u311379832
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["N, M = map(int, input().split())\npLst = [list(map(int, input().split())) for i in range(M)]\n\nfor i in range(len(pLst)):\n pLst[i].append(i)\nnLst = [''] * N\n\nfor i in range(N):\n nLst[i] = str(i + 1).zfill(6)\ntLst = sorted(pLst, key=lambda x: (x[0], x[1]))\nansLst = [''] * M\ntmp = nLst[tLst[i][0] - 1]\nindex = 1", "N, M = map(int, input().split())\npLst = [list(map(int, input().split())) for i in range(M)]\n\nfor i in range(len(pLst)):\n pLst[i].append(i)\nnLst = [''] * N\n\nfor i in range(N):\n nLst[i] = str(i + 1).zfill(6)\ntLst = sorted(pLst, key=lambda x: (x[0], x[1]))\nansLst = [''] * M\ntmp = nLst[tLst[0][0] - 1]\nindex = 1\nfor i in range(M):\n if tmp == nLst[tLst[i][0] - 1]:\n ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)\n index += 1\n else:\n index = 1\n tmp = nLst[tLst[i][0] - 1]\n ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)\n index += 1\n\nfor i in ansLst:\n print(i)"]
|
['Runtime Error', 'Accepted']
|
['s123455182', 's261618346']
|
[45716.0, 46356.0]
|
[553.0, 745.0]
|
[314, 645]
|
p03221
|
u313111801
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['def con(var):\n var=str(var)\n while(len(var)<6):\n var="0"+var\n return var\n\n\ndef run():\n N,M=map(int,input().split())\n P=[-1]*M\n Y=[-1]*M\n arr=[]\n for i in range(M):\n P[i],Y[i]=input().split()\n P[i]=int(P[i])-1\n Y[i]=int(Y[i])\n arr.append([P[i],Y[i],i])\n arr=sorted(arr,key=lambda x:x[1])\n print(arr)\n ans=[0]*M\n cnt=[0]*N\n for i in range(M):\n cnt[arr[i][0]]=cnt[arr[i][0]]+1\n ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])\n for i in range(M):\n print(ans[i])\nrun()\n', 'def con(var):\n var=str(var)\n while(len(var)<6):\n var="0"+var\n return var\n\n\n\ndef run():\n N,M=input().split()\n N=int(N)\n M=int(M)\n P=[-1]*M\n Y=[-1]*M\n arr=[]\n for i in range(M):\n P[i],Y[i]=input().split()\n P[i]=int(P[i])-1\n Y[i]=int(Y[i])\n arr.append([P[i],Y[i],i])\n arr=sorted(arr,key=lambda x:x[1])\n print(arr)\n ans=[0]*M\n cnt=[0]*N\n for i in range(M):\n cnt[arr[i][0]]=cnt[arr[i][0]]+1\n ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])\n for i in range(M):\n print(ans[i])\nrun()', 'def con(var):\n var=str(var)\n while(len(var)<6):\n var="0"+var\n return var\n\n\ndef run():\n N,M=map(int,input().split())\n P=[-1]*M\n Y=[-1]*M\n arr=[]\n for i in range(M):\n P[i],Y[i]=map(int,input().split())\n P[i]=P[i]-1\n arr.append([P[i],Y[i],i])\n arr=sorted(arr,key=lambda x:x[1])\n ans=[0]*M\n cnt=[0]*N\n for i in range(M):\n cnt[arr[i][0]]=cnt[arr[i][0]]+1\n ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])\n for i in range(M):\n print(ans[i])\nrun()']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s391911608', 's596229638', 's696434409']
|
[36280.0, 36276.0, 33736.0]
|
[724.0, 719.0, 692.0]
|
[566, 583, 531]
|
p03221
|
u316386814
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
["n, m = list(map(int, input().split()))\nli = []\nyli = []\nfor _ in range(m):\n p, y = list(map(int, input().split()))\n li.append((y, p))\n yli.append(y)\n\nimport numpy as np\nidx = np.argsort(yli)\nsrt = sorted(li)\nans = []\nfrom collections import Counter\npcnt = Counter()\nfor p, y in srt:\n pcnt[p] += 1 \n ans.append('{:06}{:06}'.format(p, pcnt[p]))\n\nfor i in idx:\n print(ans[i])\n", "n, m = list(map(int, input().split()))\nli = []\nyli = []\nfor _ in range(m):\n p, y = list(map(int, input().split()))\n li.append((y, p))\n yli.append(y)\n\nimport numpy as np\nidx = np.argsort(yli).argsort()\nsrt = sorted(li)\nans = []\nfrom collections import Counter\npcnt = Counter()\nfor p, y in srt:\n pcnt[p] += 1 \n ans.append('{:06}{:06}'.format(p, pcnt[p]))\n\nfor i in idx:\n print(ans[i])\n", "n, m = list(map(int, input().split()))\nli = []\nyli = []\nfor _ in range(m):\n p, y = list(map(int, input().split()))\n li.append((y, p))\n yli.append(y)\n\nimport numpy as np\nidx = np.argsort(yli).argsort()\nsrt = sorted(li)\nans = []\nfrom collections import Counter\npcnt = Counter()\nfor y, p in srt:\n pcnt[p] += 1\n ans.append('{:06}{:06}'.format(p, pcnt[p]))\n\nfor i in idx:\n print(ans[i])\n"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s717242868', 's723440011', 's837111056']
|
[44272.0, 51916.0, 46316.0]
|
[951.0, 1046.0, 1012.0]
|
[394, 404, 400]
|
p03221
|
u317713173
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['N, M = map(int, input().split())\npref_dict = {}\n\nfor i in range(M):\n P, Y = map(int, input().split())\n pref_dict[i] = [P, Y]\n\nsorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))\nprint(sorted_dict)\n\nans_dict = {}\nbuf = ""\ncount = 1\n\nfor tup in sorted_dict:\n\n row = tup[0]\n pref_name = f"00000{tup[1][0]}"[-6:]\n\n if pref_name == buf:\n count += 1\n else:\n count = 1\n\n pref_id = f"00000{count}"[-6:]\n ans_dict[row] = [pref_name, pref_id]\n buf = pref_name\n\nfor key, value in sorted(ans_dict.items(), key=lambda x: x[0]):\n print(*value, sep="")', 'N, M = map(int, input().split())\npref_dict = {}\n\nfor i in range(M):\n P, Y = map(int, input().split())\n pref_dict[i] = [P, Y]\n\nsorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))\nans_dict = {}\nbuf = ""\ncount = 1\n\nfor tup in sorted_dict:\n\n row = tup[0]\n pref_name = "00000{}".format(tup[1][0])\n pref_name = pref_name[-6:]\n\n if pref_name == buf:\n count += 1\n else:\n count = 1\n\n pref_id = "00000{}".format(count)\n pref_id = pref_id[-6:]\n ans_dict[row] = [pref_name, pref_id]\n buf = pref_name\n\nfor key, value in sorted(ans_dict.items(), key=lambda x: x[0]):\n print(*value, sep="")']
|
['Runtime Error', 'Accepted']
|
['s827648644', 's996760790']
|
[3064.0, 74096.0]
|
[17.0, 1224.0]
|
[605, 649]
|
p03221
|
u319695085
| 2,000
| 1,048,576
|
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each city. If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x. Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits. Find the ID numbers for all the cities. Note that there can be a prefecture with no cities.
|
['#!/usr/bin/env python3\n\nimport numpy as np\n\n# line1 = "2 3"\n# line2 = [\'1 32\', \'2 63\', \'1 12\']\n\nN, M = map(int, input().split())\nprefinfo = [input() for i in range(N)]\nPY = [list(map(int, line.split())) for line in prefinfo]\n\nPY = np.array(PY)\ncn = np.array([np.arange(np.shape(PY)[0])])\ncc = np.array([np.zeros(np.shape(PY)[0], dtype=int)])\n\ncity_list = np.hstack([cn.T, PY, cc.T])\ncl_ysort = city_list[np.argsort(city_list[:, 2])]\ncity_count = np.zeros(N+1, dtype=int)\nfor i, cinfo in enumerate(cl_ysort):\n pref = cinfo[1]\n city_count[pref] += 1\n cl_ysort[i, 3] = city_count[pref]\n\ncl_idsort = cl_ysort[np.argsort(cl_ysort[:, 0])]\n\n[print(\'{:06d}{:06d}\'.format(cl[1], cl[3])) for cl in cl_idsort]\n', '#!/usr/bin/env python3\n\nimport numpy as np\n\n# line1 = "2 3"\n# line2 = [\'1 32\', \'2 63\', \'1 12\']\n\nN, M = map(int, input().split())\nprefinfo = [input() for i in range(M)]\nPY = [list(map(int, line.split())) for line in prefinfo]\n\nPY = np.array(PY)\ncn = np.array([np.arange(np.shape(PY)[0])])\ncc = np.array([np.zeros(np.shape(PY)[0], dtype=int)])\n\ncity_list = np.hstack([cn.T, PY, cc.T])\ncl_ysort = city_list[np.argsort(city_list[:, 2])]\ncity_count = np.zeros(N+1, dtype=int)\nfor i, cinfo in enumerate(cl_ysort):\n pref = cinfo[1]\n city_count[pref] += 1\n cl_ysort[i, 3] = city_count[pref]\n\ncl_idsort = cl_ysort[np.argsort(cl_ysort[:, 0])]\n\n[print(\'{:06d}{:06d}\'.format(cl[1], cl[3])) for cl in cl_idsort]\n']
|
['Runtime Error', 'Accepted']
|
['s433720613', 's643979748']
|
[45700.0, 45660.0]
|
[1036.0, 1029.0]
|
[710, 710]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.