結果
問題 | No.1306 Exactly 2 Digits |
ユーザー | Kude |
提出日時 | 2020-12-03 02:51:39 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 217 ms / 2,000 ms |
コード長 | 1,176 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 28,904 KB |
平均クエリ数 | 1236.78 |
最終ジャッジ日時 | 2024-07-17 08:17:33 |
合計ジャッジ時間 | 19,841 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
27,848 KB |
testcase_01 | AC | 50 ms
27,720 KB |
testcase_02 | AC | 49 ms
27,736 KB |
testcase_03 | AC | 51 ms
27,088 KB |
testcase_04 | AC | 50 ms
27,480 KB |
testcase_05 | AC | 51 ms
27,352 KB |
testcase_06 | AC | 51 ms
27,480 KB |
testcase_07 | AC | 51 ms
27,608 KB |
testcase_08 | AC | 50 ms
27,352 KB |
testcase_09 | AC | 50 ms
27,608 KB |
testcase_10 | AC | 51 ms
27,608 KB |
testcase_11 | AC | 49 ms
27,352 KB |
testcase_12 | AC | 50 ms
27,480 KB |
testcase_13 | AC | 50 ms
27,592 KB |
testcase_14 | AC | 50 ms
27,336 KB |
testcase_15 | AC | 50 ms
27,336 KB |
testcase_16 | AC | 51 ms
27,344 KB |
testcase_17 | AC | 52 ms
27,080 KB |
testcase_18 | AC | 51 ms
27,208 KB |
testcase_19 | AC | 51 ms
27,592 KB |
testcase_20 | AC | 51 ms
27,848 KB |
testcase_21 | AC | 52 ms
27,592 KB |
testcase_22 | AC | 51 ms
27,336 KB |
testcase_23 | AC | 51 ms
27,720 KB |
testcase_24 | AC | 50 ms
27,592 KB |
testcase_25 | AC | 50 ms
27,208 KB |
testcase_26 | AC | 50 ms
27,336 KB |
testcase_27 | AC | 50 ms
27,208 KB |
testcase_28 | AC | 51 ms
27,592 KB |
testcase_29 | AC | 52 ms
27,336 KB |
testcase_30 | AC | 50 ms
27,720 KB |
testcase_31 | AC | 51 ms
27,592 KB |
testcase_32 | AC | 50 ms
27,336 KB |
testcase_33 | AC | 51 ms
27,464 KB |
testcase_34 | AC | 51 ms
27,336 KB |
testcase_35 | AC | 51 ms
27,208 KB |
testcase_36 | AC | 51 ms
27,336 KB |
testcase_37 | AC | 51 ms
27,080 KB |
testcase_38 | AC | 53 ms
27,848 KB |
testcase_39 | AC | 51 ms
27,720 KB |
testcase_40 | AC | 52 ms
27,080 KB |
testcase_41 | AC | 54 ms
27,208 KB |
testcase_42 | AC | 52 ms
27,208 KB |
testcase_43 | AC | 52 ms
27,848 KB |
testcase_44 | AC | 53 ms
27,848 KB |
testcase_45 | AC | 53 ms
27,336 KB |
testcase_46 | AC | 54 ms
27,592 KB |
testcase_47 | AC | 55 ms
27,328 KB |
testcase_48 | AC | 59 ms
27,592 KB |
testcase_49 | AC | 58 ms
27,592 KB |
testcase_50 | AC | 60 ms
27,336 KB |
testcase_51 | AC | 60 ms
27,336 KB |
testcase_52 | AC | 63 ms
27,336 KB |
testcase_53 | AC | 67 ms
27,360 KB |
testcase_54 | AC | 64 ms
27,208 KB |
testcase_55 | AC | 69 ms
27,336 KB |
testcase_56 | AC | 71 ms
27,464 KB |
testcase_57 | AC | 73 ms
27,208 KB |
testcase_58 | AC | 77 ms
27,336 KB |
testcase_59 | AC | 75 ms
27,592 KB |
testcase_60 | AC | 85 ms
27,336 KB |
testcase_61 | AC | 91 ms
27,592 KB |
testcase_62 | AC | 92 ms
27,592 KB |
testcase_63 | AC | 93 ms
27,848 KB |
testcase_64 | AC | 92 ms
27,848 KB |
testcase_65 | AC | 97 ms
28,104 KB |
testcase_66 | AC | 105 ms
27,720 KB |
testcase_67 | AC | 106 ms
27,848 KB |
testcase_68 | AC | 105 ms
27,976 KB |
testcase_69 | AC | 111 ms
27,976 KB |
testcase_70 | AC | 111 ms
27,464 KB |
testcase_71 | AC | 117 ms
27,976 KB |
testcase_72 | AC | 118 ms
27,976 KB |
testcase_73 | AC | 115 ms
28,136 KB |
testcase_74 | AC | 130 ms
27,592 KB |
testcase_75 | AC | 125 ms
28,360 KB |
testcase_76 | AC | 140 ms
28,104 KB |
testcase_77 | AC | 148 ms
27,976 KB |
testcase_78 | AC | 157 ms
27,720 KB |
testcase_79 | AC | 169 ms
27,976 KB |
testcase_80 | AC | 178 ms
28,104 KB |
testcase_81 | AC | 146 ms
27,848 KB |
testcase_82 | AC | 181 ms
28,104 KB |
testcase_83 | AC | 183 ms
28,232 KB |
testcase_84 | AC | 195 ms
28,104 KB |
testcase_85 | AC | 205 ms
28,616 KB |
testcase_86 | AC | 173 ms
28,360 KB |
testcase_87 | AC | 182 ms
28,488 KB |
testcase_88 | AC | 217 ms
28,104 KB |
testcase_89 | AC | 183 ms
28,104 KB |
testcase_90 | AC | 165 ms
28,744 KB |
testcase_91 | AC | 181 ms
28,104 KB |
testcase_92 | AC | 168 ms
28,360 KB |
testcase_93 | AC | 192 ms
28,104 KB |
testcase_94 | AC | 169 ms
28,360 KB |
testcase_95 | AC | 175 ms
28,616 KB |
testcase_96 | AC | 162 ms
28,128 KB |
testcase_97 | AC | 163 ms
28,488 KB |
testcase_98 | AC | 155 ms
28,488 KB |
testcase_99 | AC | 179 ms
28,488 KB |
testcase_100 | AC | 181 ms
28,232 KB |
testcase_101 | AC | 195 ms
28,616 KB |
testcase_102 | AC | 165 ms
28,232 KB |
testcase_103 | AC | 174 ms
28,488 KB |
testcase_104 | AC | 176 ms
27,976 KB |
testcase_105 | AC | 181 ms
28,904 KB |
testcase_106 | AC | 161 ms
28,672 KB |
testcase_107 | AC | 178 ms
28,232 KB |
testcase_108 | AC | 165 ms
28,360 KB |
testcase_109 | AC | 197 ms
28,488 KB |
testcase_110 | AC | 168 ms
28,744 KB |
testcase_111 | AC | 176 ms
28,360 KB |
testcase_112 | AC | 155 ms
27,976 KB |
testcase_113 | AC | 204 ms
28,392 KB |
testcase_114 | AC | 206 ms
28,232 KB |
testcase_115 | AC | 178 ms
28,232 KB |
testcase_116 | AC | 216 ms
28,640 KB |
testcase_117 | AC | 184 ms
28,488 KB |
testcase_118 | AC | 194 ms
28,232 KB |
testcase_119 | AC | 170 ms
28,744 KB |
testcase_120 | AC | 164 ms
28,232 KB |
testcase_121 | AC | 185 ms
27,976 KB |
testcase_122 | AC | 183 ms
28,360 KB |
ソースコード
from collections import defaultdict n = int(input()) sz = n * n - n def query(i, j): print('?', i+1, j+1) return tuple(map(int, input().split())) d = [(0, 0) if i == 0 else query(i, 0) for i in range(sz)] i_mn = min(range(sz), key=lambda x: d[x]) i_mx = max(range(sz), key=lambda x: d[x]) p0, q0 = -d[i_mn][0], -d[i_mn][1] if p0 + d[i_mx][0] != n - 2: p0, q0 = q0, p0 d2i = defaultdict(list) for i in range(sz): d2i[d[i]].append(i) ans = [None] * sz for (p, q), s in d2i.items(): if len(s) == 1: np, nq = p0 + p, q0 + q if not (0 <= np <= n - 2 and 0 <= nq <= n - 1): np, nq = p0 + q, q0 + p ans[s[0]] = (np, nq) else: if p0 != q0: a, b = query(s[0], i_mn) if {a, b} != {p0 + p, q0 + q}: p, q = q, p ans[s[0]] = (p0 + p, q0 + q) ans[s[1]] = (p0 + q, q0 + p) else: a, b = query(s[0], i_mx) if {a, b} != {p0 + p - (n - 2), q0 + q - (n - 1)}: p, q = q, p ans[s[0]] = (p0 + p, q0 + q) ans[s[1]] = (p0 + q, q0 + p) ans = [(t[0] + 1) * n + t[1] for t in ans] print('!', *ans)