結果

問題 No.2502 Optimization in the Dark
ユーザー suisensuisen
提出日時 2023-01-12 16:25:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 69,576 KB
平均クエリ数 4.00
最終ジャッジ日時 2024-09-15 16:05:56
合計ジャッジ時間 5,722 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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:
        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)

n = int(input())

if query(2, 1, 3, 1):
    if query(1, 1, 2, 1):
        i1, j1 = 2, 3
    else:
        i1, j1 = 1, 3
else:
    if query(1, 1, 3, 1):
        i1, j1 = 2, 3
    else:
        i1, j1 = 1, 2

i2 = i1 ^ j1
if query(i1, n + 1, j1, n + 1):
    j2 = j1
else:
    j2 = i1

i3, j3 = i2, j2 ^ i1 ^ j1

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