結果
問題 | No.2577 Simple Permutation Guess |
ユーザー | 👑 rin204 |
提出日時 | 2023-12-05 00:31:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,158 bytes |
コンパイル時間 | 363 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 95,760 KB |
平均クエリ数 | 249.73 |
最終ジャッジ日時 | 2024-09-26 23:41:55 |
合計ジャッジ時間 | 28,354 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | QLE | - |
testcase_17 | AC | 66 ms
71,392 KB |
testcase_18 | QLE | - |
testcase_19 | WA | - |
testcase_20 | QLE | - |
testcase_21 | QLE | - |
testcase_22 | QLE | - |
testcase_23 | WA | - |
testcase_24 | QLE | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | QLE | - |
testcase_28 | WA | - |
testcase_29 | QLE | - |
testcase_30 | WA | - |
testcase_31 | QLE | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | QLE | - |
testcase_36 | WA | - |
testcase_37 | AC | 62 ms
71,008 KB |
testcase_38 | AC | 63 ms
71,256 KB |
testcase_39 | AC | 63 ms
70,616 KB |
testcase_40 | WA | - |
testcase_41 | QLE | - |
testcase_42 | WA | - |
testcase_43 | QLE | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | QLE | - |
testcase_48 | QLE | - |
testcase_49 | WA | - |
testcase_50 | QLE | - |
testcase_51 | WA | - |
testcase_52 | QLE | - |
testcase_53 | QLE | - |
testcase_54 | QLE | - |
testcase_55 | QLE | - |
testcase_56 | QLE | - |
testcase_57 | WA | - |
testcase_58 | QLE | - |
testcase_59 | QLE | - |
testcase_60 | QLE | - |
testcase_61 | QLE | - |
testcase_62 | WA | - |
testcase_63 | QLE | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | WA | - |
testcase_85 | WA | - |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | WA | - |
testcase_93 | WA | - |
testcase_94 | WA | - |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | WA | - |
testcase_98 | WA | - |
testcase_99 | WA | - |
testcase_100 | WA | - |
testcase_101 | WA | - |
evil_1_rnd_1.txt | WA | - |
evil_1_rnd_2.txt | WA | - |
evil_2_big_1.txt | WA | - |
evil_2_big_2.txt | WA | - |
evil_2_big_3.txt | WA | - |
evil_3_sorted_1.txt | WA | - |
evil_4_sorted_rev_1.txt | WA | - |
evil_4_sorted_rev_2.txt | WA | - |
evil_400_sorted.txt | WA | - |
evil_400_sorted_rev.txt | WA | - |
ソースコード
import random DEBUG = 1 class BIT: def __init__(self, n): self.n = n self.data = [0] * (n + 1) if n == 0: self.n0 = 0 else: self.n0 = 1 << (n.bit_length() - 1) def sum_(self, i): s = 0 while i > 0: s += self.data[i] i -= i & -i return s def sum(self, l, r=-1): if r == -1: return self.sum_(l) else: return self.sum_(r) - self.sum_(l) def get(self, i): return self.sum(i, i + 1) def add(self, i, x): i += 1 while i <= self.n: self.data[i] += x i += i & -i def lower_bound(self, x): if x <= 0: return 0 i = 0 k = self.n0 while k > 0: if i + k <= self.n and self.data[i + k] < x: x -= self.data[i + k] i += k k //= 2 return i + 1 n = int(input()) if DEBUG: ans = [i for i in range(1, n + 1)] random.shuffle(ans) L = [0] * n R = [i for i in range(n)] def f(): X = [(l + r) for l, r in zip(L, R)] for i in range(n - 1): if X[i] > i: X[i] -= i + 1 X[i + 1] += 1 for i in range(n - 1, 0, -1): if X[i] % 2 == 1: X[i - 1] += i X[i] //= 2 X[0] //= 2 return X def ask(X, q="?"): P = [] bit = BIT(n) for i in range(n): bit.add(i, 1) for x in X[::-1]: p = bit.lower_bound(x + 1) - 1 P.append(p + 1) bit.add(p, -1) print(q, *P, flush=True) if DEBUG: for i in range(n): if P[i] < ans[i]: return 1 elif P[i] > ans[i]: return 0 return 1 if len(set(P)) != n: return -1 if q == "?": return int(input()) else: assert ans == P while 1: mid = f() if mid == L: break res = ask(mid) if res == -1: exit() if res == 0: R = mid else: L = mid res = ask(R) if res == -1: exit() if res == 1: ask(R, "!") else: ask(L, "!")