結果

問題 No.1306 Exactly 2 Digits
ユーザー WizistWizist
提出日時 2020-12-04 03:36:15
言語 PyPy3
(7.3.13)
結果
RE  
実行時間 -
コード長 1,462 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 329,120 KB
平均クエリ数 311.81
最終ジャッジ日時 2023-09-24 08:56:18
合計ジャッジ時間 44,262 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
87,712 KB
testcase_01 AC 99 ms
87,856 KB
testcase_02 AC 99 ms
87,772 KB
testcase_03 AC 100 ms
87,236 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 99 ms
87,424 KB
testcase_07 AC 96 ms
87,196 KB
testcase_08 AC 99 ms
87,548 KB
testcase_09 AC 97 ms
87,508 KB
testcase_10 AC 96 ms
86,948 KB
testcase_11 RE -
testcase_12 AC 99 ms
87,584 KB
testcase_13 AC 101 ms
87,516 KB
testcase_14 RE -
testcase_15 AC 99 ms
87,540 KB
testcase_16 RE -
testcase_17 AC 101 ms
87,224 KB
testcase_18 RE -
testcase_19 AC 100 ms
86,904 KB
testcase_20 AC 101 ms
86,840 KB
testcase_21 AC 99 ms
87,060 KB
testcase_22 AC 100 ms
87,724 KB
testcase_23 AC 101 ms
87,364 KB
testcase_24 RE -
testcase_25 AC 102 ms
87,624 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 100 ms
87,320 KB
testcase_29 AC 100 ms
87,480 KB
testcase_30 AC 100 ms
87,292 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 99 ms
87,572 KB
testcase_34 AC 102 ms
87,708 KB
testcase_35 AC 100 ms
86,968 KB
testcase_36 RE -
testcase_37 AC 101 ms
87,392 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 105 ms
87,340 KB
testcase_43 AC 114 ms
92,372 KB
testcase_44 RE -
testcase_45 AC 122 ms
92,436 KB
testcase_46 AC 127 ms
92,500 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 AC 143 ms
93,088 KB
testcase_50 AC 142 ms
92,872 KB
testcase_51 AC 165 ms
95,804 KB
testcase_52 AC 177 ms
95,708 KB
testcase_53 RE -
testcase_54 AC 176 ms
96,012 KB
testcase_55 AC 201 ms
95,896 KB
testcase_56 RE -
testcase_57 AC 227 ms
99,980 KB
testcase_58 AC 244 ms
102,284 KB
testcase_59 AC 246 ms
103,308 KB
testcase_60 RE -
testcase_61 RE -
testcase_62 RE -
testcase_63 RE -
testcase_64 AC 402 ms
119,936 KB
testcase_65 AC 444 ms
125,468 KB
testcase_66 RE -
testcase_67 RE -
testcase_68 AC 579 ms
145,412 KB
testcase_69 RE -
testcase_70 AC 689 ms
163,024 KB
testcase_71 AC 731 ms
175,064 KB
testcase_72 AC 767 ms
188,948 KB
testcase_73 AC 844 ms
204,220 KB
testcase_74 AC 991 ms
223,208 KB
testcase_75 AC 1,058 ms
243,364 KB
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 TLE -
testcase_81 AC 1,833 ms
327,864 KB
testcase_82 TLE -
testcase_83 TLE -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
testcase_102 -- -
testcase_103 -- -
testcase_104 -- -
testcase_105 -- -
testcase_106 -- -
testcase_107 -- -
testcase_108 -- -
testcase_109 -- -
testcase_110 -- -
testcase_111 -- -
testcase_112 -- -
testcase_113 -- -
testcase_114 -- -
testcase_115 -- -
testcase_116 -- -
testcase_117 -- -
testcase_118 -- -
testcase_119 -- -
testcase_120 -- -
testcase_121 -- -
testcase_122 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#
# No.1306 Exactly 2 Digits
#
import sys, os, math

def read_int(): return int(input())
def read_ints(): return list(map(int, input().split()))

n = read_int()
m = n * n - n
a = [None for _ in range(m)]

z = {}
for i in range(n, n * n):
	for j in range(n, n * n):
		if i != j:
			p, q = i // n - j // n, i % n - j % n
			if p > q: p, q = q, p
			if (p, q) not in z: z[(p, q)] = []
			z[(p, q)].append((i, j))
# print(z)
d = {}
i = 0
for j in range(i + 1, m):
	print("? {} {}".format(i + 1, j + 1), flush=True)
	p, q = read_ints()
	s1, s2 = set(), set()
	for x, y in z[(p, q)]:
		if (not a[i] or x in a[i]) and (not a[j] or y in a[j]):
			s1.add(x); s2.add(y)
	a[i] = s1; a[j] = s2
	if len(a[i]) == 1: d[list(a[i])[0]] = i
	if len(a[j]) == 1: d[list(a[j])[0]] = j
	# print(a[i], a[j], d, file=sys.stderr)

t = []
for i, s in enumerate(a):
	if len(s) > 1:
		for x in list(s):
			if x in d: s.remove(x)
		if len(s) == 1:
			d[list(s)[0]] = i
	if len(s) > 1: t.append(i)

while len(t) > 0:
	j = t.pop()
	for k, i in d.items():
		if i == 0: continue
		print("? {} {}".format(i + 1, j + 1), flush=True)
		p, q = read_ints()
		s = set()
		for x, y in z[(p, q)]:
			if (not a[i] or x in a[i]) and (not a[j] or y in a[j]):
				s.add(y)
		a[j] = s
		# print(a[i], a[j], file=sys.stderr)
		if len(a[j]) == 1: break
	if len(a[j]) == 1: d[list(a[j])[0]] = j
	else: t.append(j)

print("! {}".format(" ".join([str(list(x)[0]) for x in a])), flush=True)
0