結果
| 問題 |
No.3212 SUPER Guess the Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-25 21:43:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 984 bytes |
| コンパイル時間 | 1,634 ms |
| コンパイル使用メモリ | 195,508 KB |
| 実行使用メモリ | 25,972 KB |
| 平均クエリ数 | 5.00 |
| 最終ジャッジ日時 | 2025-07-25 21:43:27 |
| 合計ジャッジ時間 | 4,719 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int answer = 1000;
int back = -1001001001;
int low = 0,high = 1000000;
auto ask = [&](int x) -> void {
cout << "? " << x << endl;
if(back != -1001001001){
int memo = x;
int near; cin >> near;
if(near == 0) swap(back,x);
int start = -1;
for(int p=low; p<=high; p++){
if(abs(p-x) <= abs(p-back)){
if(start == -1) start = p;
}
else{high = p-1; break;}
}
low = start;
back = memo;
}
else back = x;
};
ask(high);
while(low != high){
if(high <= back){
int d = back-high;
ask(low-d);
}
else{
int d = low-back;
ask(high+d);
}
}
cout << "! " << low << endl;
}