結果
問題 |
No.3212 SUPER Guess the Number
|
ユーザー |
|
提出日時 | 2025-07-25 23:29:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 1,117 bytes |
コンパイル時間 | 1,612 ms |
コンパイル使用メモリ | 195,116 KB |
実行使用メモリ | 25,972 KB |
平均クエリ数 | 21.83 |
最終ジャッジ日時 | 2025-07-25 23:29:17 |
合計ジャッジ時間 | 2,893 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<n;i++) #define srep(i,l,r) for(ll i=l;i<=r;i++) #define irep(i,r,l) for(ll i=r;i>=l;i--) using ll = long long; using ld = long double; const ll mod=998244353; #define vout(v) for(auto i :v) cout<<i<<" "; #define INF 9223300000000000000ll #define Winf 5e12 #define nl "\n" #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define vl vector<ll> #define pb push_back #define vc vector<char> void no() { cout<<"No"<<nl;} void yes() { cout<<"Yes"<<nl;} void yn(bool a) { cout<<(a ? "Yes":"No")<<nl; } template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} int main() { ll lef=1,rig=1000001; ll prev=0,ask; cout<<"? 0"<<endl; while(rig-lef>1) { ll mid=(rig-lef)/2+lef; ask=2*mid-prev-1; cout<<"? "<<ask<<endl; int ans; cin>>ans; if(bool(ans)==(ask>=prev)) lef=mid; else rig=mid; prev=ask; } cout<<"! "<<lef<<nl; }