結果
問題 | No.1306 Exactly 2 Digits |
ユーザー | tamato |
提出日時 | 2020-12-30 23:32:15 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,410 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 95,440 KB |
平均クエリ数 | 1032.47 |
最終ジャッジ日時 | 2024-07-17 10:21:00 |
合計ジャッジ時間 | 38,828 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | WA | - |
testcase_02 | AC | 63 ms
71,692 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | RE | - |
testcase_07 | WA | - |
testcase_08 | AC | 64 ms
70,476 KB |
testcase_09 | AC | 65 ms
71,256 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 62 ms
70,048 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | RE | - |
testcase_20 | WA | - |
testcase_21 | RE | - |
testcase_22 | WA | - |
testcase_23 | RE | - |
testcase_24 | WA | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | WA | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | WA | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | WA | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | RE | - |
testcase_51 | RE | - |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | RE | - |
testcase_55 | RE | - |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | RE | - |
testcase_59 | RE | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | RE | - |
testcase_63 | RE | - |
testcase_64 | RE | - |
testcase_65 | RE | - |
testcase_66 | RE | - |
testcase_67 | RE | - |
testcase_68 | RE | - |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | RE | - |
testcase_72 | RE | - |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | RE | - |
testcase_76 | RE | - |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | RE | - |
testcase_81 | RE | - |
testcase_82 | RE | - |
testcase_83 | RE | - |
testcase_84 | RE | - |
testcase_85 | RE | - |
testcase_86 | RE | - |
testcase_87 | RE | - |
testcase_88 | WA | - |
testcase_89 | RE | - |
testcase_90 | RE | - |
testcase_91 | RE | - |
testcase_92 | RE | - |
testcase_93 | RE | - |
testcase_94 | RE | - |
testcase_95 | RE | - |
testcase_96 | RE | - |
testcase_97 | RE | - |
testcase_98 | RE | - |
testcase_99 | RE | - |
testcase_100 | RE | - |
testcase_101 | RE | - |
testcase_102 | RE | - |
testcase_103 | RE | - |
testcase_104 | RE | - |
testcase_105 | RE | - |
testcase_106 | RE | - |
testcase_107 | RE | - |
testcase_108 | RE | - |
testcase_109 | RE | - |
testcase_110 | RE | - |
testcase_111 | RE | - |
testcase_112 | RE | - |
testcase_113 | RE | - |
testcase_114 | RE | - |
testcase_115 | RE | - |
testcase_116 | RE | - |
testcase_117 | RE | - |
testcase_118 | RE | - |
testcase_119 | RE | - |
testcase_120 | RE | - |
testcase_121 | RE | - |
testcase_122 | RE | - |
ソースコード
mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline def ask(i, j): print("?", i, j) sys.stdout.flush() N = int(input()) info = [] S = [] for j in range(2, N**2 - N + 1): ask(1, j) p, q = map(int, input().split()) info.append((p, q)) S.append(p+q) ans = [-1] * (N**2 - N) ma = max(S) if ma < 0: ans[0] = N mi = min(S) for j, s in enumerate(S): if s == mi: ans[j+1] = N**2 - 1 jj = j+2 break seen = [None] * (2 * N + 5) for j, s in enumerate(S): if j == jj-2: continue if seen[s] is not None: ans[j+1] = seen[s] else: p, q = info[j] cand = [] a, b = -p+1, -q if 0 <= a < N and 1 <= b < N: cand.append((a, b)) a, b = -q+1, -p if 0 <= a < N and 1 <= b < N: cand.append((a, b)) if len(cand) == 1: ans[j+1] = a * N + b else: ask(jj, j+2) p_new, q_new = map(int, input().split()) p1, q1 = sorted([N-1 - cand[0][0], N-1 - cand[0][1]]) if p1 == p_new and q1 == q_new: ans[j+1] = cand[0][0] * N + cand[0][1] seen[s] = cand[1][0] * N + cand[1][1] else: ans[j + 1] = cand[1][0] * N + cand[1][1] seen[s] = cand[0][0] * N + cand[0][1] else: mi = min(S) for j, s in enumerate(S): if s == ma: j_ma = j elif s == mi: j_mi = j ans[j_mi + 1] = N**2 - 1 ans[j_ma + 1] = N a, b = info[j_mi] x, y = a + N - 1, b + N - 1 c, d = info[j_ma] if c == x-1 and d == y: ans[0] = x * N + y K = ans[0] else: ans[0] = y * N + x K = ans[0] x, y = y, x seen = [None] * (4 * N + 5) for j, s in enumerate(S): if j == j_mi or j == j_ma: continue if seen[s] is not None: ans[j + 1] = seen[s] else: p, q = info[j] cand = [] a, b = -p + x, -q + y if 0 <= a < N and 1 <= b < N: cand.append((a, b)) a, b = -q + x, -p + y if 0 <= a < N and 1 <= b < N: cand.append((a, b)) if len(cand) == 1: ans[j + 1] = a * N + b else: ask(j_ma, j+2) p_new, q_new = map(int, input().split()) p1, q1 = sorted([1 - cand[0][0], -cand[0][1]]) if p1 == p_new and q1 == q_new: ans[j + 1] = cand[0][0] * N + cand[0][1] seen[s] = cand[1][0] * N + cand[1][1] else: ans[j + 1] = cand[1][0] * N + cand[1][1] seen[s] = cand[0][0] * N + cand[0][1] ans = ["!"] + ans print(*ans) sys.stdout.flush() if __name__ == '__main__': main()