結果

問題 No.2502 Optimization in the Dark
ユーザー suisen
提出日時 2023-02-21 12:35:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 69,832 KB
平均クエリ数 4.00
最終ジャッジ日時 2024-09-15 16:06:02
合計ジャッジ時間 5,585 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

def query(i, x, j, y):
    print('?', i, x, j, y, flush=True, end='\r\n')
    response = input()
    if response == "Yes":
        return True
    elif response == "No":
        return False
    else:
        assert False

def output_answer(n, i1, j1, i2, j2, i3, j3):
    out = []
    for _ in range(n): out += [i1, j1]
    for _ in range(n): out += [i2, j2]
    for _ in range(n): out += [i3, j3]
    print('!', *out, flush=True, end='\r\n')

n = int(input())

if query(2, 2 * n, 3, 2 * n):
    if query(1, 2 * n, 3, 2 * n):
        i3, j3 = 1, 2
    else:
        i3, j3 = 2, 3
else:
    if query(1, 2 * n, 2, 2 * n):
        i3, j3 = 1, 3
    else:
        i3, j3 = 2, 3

i2 = i3 ^ j3
if query(i3, n, j3, n):
    j2 = i3
else:
    j2 = j3

i1, j1 = i2, j2 ^ i3 ^ j3

output_answer(n, i1, j1, i2, j2, i3, j3)
0