結果
| 問題 |
No.253 ロウソクの長さ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-18 03:14:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 650 bytes |
| コンパイル時間 | 4,296 ms |
| コンパイル使用メモリ | 191,880 KB |
| 最終ジャッジ日時 | 2025-01-20 21:32:17 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int query(int y) {
cout << "? " << y << endl;
cout.flush();
int x;
cin >> x;
return x;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long hi = numeric_limits<int>::max();
long long lo = -1;
int c = query(64);
int t = 1;
if (c <= 0) {
for (;;) {
c = query(0);
if (c == 0) {
cout << t << endl;
return 0;
}
++t;
}
}
while (hi - lo > 1) {
long long mi = (lo + hi) / 2;
c = query(mi - t);
if (c > 0) lo = mi;
else hi = mi;
++t;
}
cout << hi << endl;
cout.flush();
return 0;
}