結果
問題 | No.2124 Guess the Permutation |
ユーザー | terasa |
提出日時 | 2022-11-18 23:41:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 929 bytes |
コンパイル時間 | 355 ms |
コンパイル使用メモリ | 81,368 KB |
実行使用メモリ | 93,760 KB |
平均クエリ数 | 374.80 |
最終ジャッジ日時 | 2023-10-20 08:37:58 |
合計ジャッジ時間 | 3,397 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 97 ms
84,364 KB |
testcase_01 | AC | 92 ms
84,364 KB |
testcase_02 | AC | 92 ms
84,364 KB |
testcase_03 | AC | 93 ms
84,364 KB |
testcase_04 | AC | 95 ms
84,364 KB |
testcase_05 | AC | 97 ms
84,364 KB |
testcase_06 | AC | 127 ms
89,280 KB |
testcase_07 | AC | 157 ms
93,688 KB |
testcase_08 | AC | 157 ms
93,720 KB |
testcase_09 | WA | - |
ソースコード
from typing import List, Tuple, Optional from collections import deque import sys import itertools import heapq import bisect import math from collections import deque, defaultdict from functools import lru_cache, cmp_to_key input = sys.stdin.readline if __file__ != 'prog.py': sys.setrecursionlimit(10 ** 6) def readints(): return map(int, input().split()) def readlist(): return list(readints()) def readstr(): return input()[:-1] def query(l, r): print(f'? {l} {r}', flush=True) S = int(input()) return S N = int(input()) S = [query(i, i + 1) for i in range(1, N)] for i in range(1, N + 1): used = {i} ans = [i] prev = i ok = True for s in S: nxt = s - prev if nxt < 1 or N < nxt or nxt in used: ok = False break ans.append(nxt) used.add(nxt) prev = nxt else: print(f"! {' '.join([str(n) for n in ans])}")