結果
| 問題 |
No.2502 Optimization in the Dark
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-22 20:43:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,000 ms |
| コード長 | 606 bytes |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 69,704 KB |
| 平均クエリ数 | 4.00 |
| 最終ジャッジ日時 | 2024-09-15 16:06:22 |
| 合計ジャッジ時間 | 5,465 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
def query(i, x, j, y):
print('?', i, x, j, y, flush=True)
response = input()
if response == "Yes":
return True
elif response == "No":
return False
else:
exit(1)
def output_answer(n, i, j, k):
out = []
for _ in range(n): out += [i, k]
for _ in range(n): out += [j, k]
for _ in range(n): out += [i, j]
print('!', *out, flush=True)
n = int(input())
if query(1, 2 * n, 2, 2 * n):
i, j, k = 1, 3, 2
else:
i, j, k = 2, 3, 1
if query(k, 2 * n, 3, 2 * n):
j, k = k, j
if query(i, n, j, n):
i, j = j, i
output_answer(n, i, j, k)