結果
| 問題 |
No.934 Explosive energy drink
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-29 22:52:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,276 bytes |
| コンパイル時間 | 841 ms |
| コンパイル使用メモリ | 87,248 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 720.67 |
| 最終ジャッジ日時 | 2024-07-16 18:44:15 |
| 合計ジャッジ時間 | 7,617 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 17 |
ソースコード
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
#define int long long
#define endl "\n"
constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007;
string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}
int X;
bool check(int num){
cout<<"? "<<num<<endl;
cout<<flush;
for(int i = 0; i < num; i++){
if(i) cout<<" ";
cout<<i+1;
cout<<flush;
}
cout<<endl;
cout<<flush;
int ans;
cin>>ans;
return ans;
}
signed main(){
// cin.tie(nullptr);
// ios::sync_with_stdio(false);
// cout<<fixed<<setprecision(10);
int N;
vector<int> ans;
cin>>N;
int l = 1, h = N, m;
while(l+1 < h){
m = (l+h)>>1;
if(check(m)){
h = m;
} else {
l = m;
}
}
X = h;
ans.push_back(X);
for(int i = 1; i <= N; i++){
if(i == X) continue;
cout<<"? "<<2<<endl;
cout<<flush;
if(i < X) cout<<i<<" "<<X<<endl;
else cout<<X<<" "<<i<<endl;
cout<<flush;
int a;
cin>>a;
if(a)ans.push_back(i);
}
sort(ans.begin(), ans.end());
cout<<"! "<<ans.size()<<endl;
for(int i = 0; i < ans.size(); i++){
if(i) cout<<" ";
cout<<ans[i];
cout<<flush;
}
cout<<endl;
cout<<flush;
return 0;
}