結果
| 問題 | No.3518 座標当てゲーム |
| コンテスト | |
| ユーザー |
nono00
|
| 提出日時 | 2026-05-01 21:34:20 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 1,825 bytes |
| 記録 | |
| コンパイル時間 | 2,408 ms |
| コンパイル使用メモリ | 329,156 KB |
| 実行使用メモリ | 30,064 KB |
| 平均クエリ数 | 3.00 |
| 最終ジャッジ日時 | 2026-05-01 21:34:28 |
| 合計ジャッジ時間 | 5,770 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, vector<T>, greater<T>>;
#define rep2(i, n) for (ll i = 0; i < (n); i++)
#define rep3(i, l, r) for (ll i = (l); i < (r); i++)
#define rrep2(i, n) for (ll i = n; i-- > 0;)
#define rrep3(i, r, l) for (ll i = (r); i-- > (l);)
#define overload(a, b, c, d, ...) d
#define rep(...) overload(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define rrep(...) overload(__VA_ARGS__, rrep3, rrep2)(__VA_ARGS__)
#define all(x) begin(x), end(x)
bool chmin(auto& lhs, auto rhs) {
return lhs > rhs ? lhs = rhs, 1 : 0;
}
bool chmax(auto& lhs, auto rhs) {
return lhs < rhs ? lhs = rhs, 1 : 0;
}
struct IOIO {
IOIO() {
std::cin.tie(0)->sync_with_stdio(0);
}
} ioio;
#ifdef DEBUG
struct Judge {
int X;
Judge() {
mt19937 mt(random_device{}());
X = mt() % (1000 - (-1000) + 1) - 1000;
cerr << "X = " << X << endl;
}
int ask(int x) {
cerr << "ask " << x << endl;
return abs(x - X);
}
void answer(int x) {
assert(x == X);
cerr << "AC!" << endl;
}
};
#else
struct Judge {
Judge() {}
int ask(int x) {
cout << "? " << x << '\n';
cout.flush();
int res;
cin >> res;
return res;
}
void answer(int x) {
cout << "! " << x << '\n';
cout.flush();
}
};
#endif
void solve() {
#ifdef DEBUG
Judge judge;
#else
Judge judge;
#endif
int delta = judge.ask(0);
int res = judge.ask(delta);
int ans = (res == 0 ? delta : -delta);
judge.answer(ans);
}
int main() {
int t = 1;
// cin >> t;
while (t--) solve();
}
nono00