結果
問題 |
No.1306 Exactly 2 Digits
|
ユーザー |
![]() |
提出日時 | 2020-12-04 00:03:00 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 943 bytes |
コンパイル時間 | 347 ms |
コンパイル使用メモリ | 82,060 KB |
実行使用メモリ | 329,284 KB |
平均クエリ数 | 267.95 |
最終ジャッジ日時 | 2024-07-17 09:16:00 |
合計ジャッジ時間 | 47,916 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 RE * 70 TLE * 4 -- * 39 |
ソースコード
#!/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) for i in range(m - 1): for j in range(i + 1, m): # if a[i] and a[j] and len(a[i]) == 1 and len(a[j]) == 1: continue if a[i] and len(a[i]) == 1: continue 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 print(a[i], a[j], file=sys.stderr) print("! {}".format(" ".join([str(list(x)[0]) for x in a])), flush=True)