結果
問題 |
No.2577 Simple Permutation Guess
|
ユーザー |
|
提出日時 | 2023-12-13 21:32:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
QLE
|
実行時間 | - |
コード長 | 1,083 bytes |
コンパイル時間 | 1,987 ms |
コンパイル使用メモリ | 179,652 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 251.96 |
最終ジャッジ日時 | 2024-09-27 05:31:33 |
合計ジャッジ時間 | 14,266 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 110 QLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i=0; i<n; i++) #define debug 0 #define YES cout << "Yes" << endl; #define NO cout << "No" << endl; using ll = long long; using ld = long double; const int mod = 998244353; const int MOD = 1000000007; const double pi = atan2(0, -1); #include <time.h> #include <chrono> int main() { int n; cin >> n; vector<int> list(n + 1); rep(i, n + 1) { list[i] = i + 1; } vector<int> ans; set<int> res; rep(i, n) { res.insert(i + 1); } rep(i, n) { int l = i, r = n; while (r > l + 1) { //Query int mid = (l + r) / 2; cout << "? "; for (int x : ans) { cout << x << " "; } cout << list[mid] << " "; for (int x : res) { if (x != list[mid]) { cout << x << " "; } } cout << endl; int ret; cin >> ret; if (ret == 0) { r = mid; } if (ret == 1) { l = mid; } } ans.push_back(list[l]); res.erase(list[l]); list[l] = -1; sort(list.begin(), list.end()); } cout << "! "; for (int x : ans) { cout << x << " "; } cout << endl; }