結果
問題 |
No.2577 Simple Permutation Guess
|
ユーザー |
![]() |
提出日時 | 2023-12-06 23:03:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,799 bytes |
コンパイル時間 | 2,315 ms |
コンパイル使用メモリ | 202,436 KB |
最終ジャッジ日時 | 2025-02-18 08:48:05 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 110 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define fi first #define se second #define mp make_pair #define si(x) int(x.size()) const int mod=998244353,MAX=300005,INF=1<<30; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int N;cin>>N; int can=0; can+=floor(log2(N)*(N-1)+1e-8); can-=(N)/2; can++; vector<int> rem(N);iota(all(rem),1); vector<int> ans; for(int t=0;t<N-1;t++){ int left=0,right=si(rem); while(right-left>1){ if(can==0){ shuffle(all(rem),rng); for(int x:rem){ ans.push_back(x); } cout<<"!"; for(int a:ans) cout<<" "<<a; cout<<endl; return 0; } int mid=(left+right)/2; vector<int> A=ans; A.push_back(rem[mid]); for(int i=0;i<si(rem);i++){ if(i!=mid) A.push_back(rem[i]); } cout<<"?"; for(int a:A) cout<<" "<<a; cout<<endl; int x;cin>>x; if(x) left=mid; else right=mid; can--; } ans.push_back(rem[left]); rem.erase(rem.begin()+left); } ans.push_back(rem.back()); cout<<"!"; for(int a:ans) cout<<" "<<a; cout<<endl; }