結果
問題 |
No.934 Explosive energy drink
|
ユーザー |
👑 |
提出日時 | 2019-11-29 22:22:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,131 bytes |
コンパイル時間 | 1,184 ms |
コンパイル使用メモリ | 76,840 KB |
実行使用メモリ | 40,656 KB |
平均クエリ数 | 83.58 |
最終ジャッジ日時 | 2024-07-16 18:35:48 |
合計ジャッジ時間 | 5,732 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 21 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n;cin>>n; vector<int> ans; for(int i = 1; n-i+ans.size() > 1; i++){ cout << "? " << n-i+ans.size() << endl; for(int j = 0; ans.size() > j; j++){ cout << ans[j]; if(j+1 != ans.size()+n-i)cout << " "; } for(int j = i; n > j; j++){ cout << j+1; if(j+1 != n)cout << " "; } cout << endl; int z;cin>>z; if(z == 0){ ans.push_back(i); } } if(ans.size() == 0){ ans.push_back(n-1); ans.push_back(n); }else if(ans.size() == 1){ cout << "? 2" << endl; cout << ans[0] << " " << n-1 << endl; int z;cin>>z; if(z == 0){ cout << "? 2" << endl; cout << ans[0] << " " << n << endl; cin>>z; if(z == 0){ ans.push_back(n-1); ans.push_back(n); }else{ ans.push_back(n); } }else{ ans.push_back(n-1); } } sort(ans.begin(),ans.end()); cout << "! " << ans.size() << endl; for(int i = 0; ans.size() > i; i++){ cout << ans[i]; if(i+1 != i)cout << " "; } cout << endl; }