結果
| 問題 |
No.3212 SUPER Guess the Number
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2025-07-25 21:58:16 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 1,602 bytes |
| コンパイル時間 | 3,095 ms |
| コンパイル使用メモリ | 279,920 KB |
| 実行使用メモリ | 25,844 KB |
| 平均クエリ数 | 21.75 |
| 最終ジャッジ日時 | 2025-07-25 21:58:34 |
| 合計ジャッジ時間 | 4,610 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
#if __INCLUDE_LEVEL__ == 0
#include __BASE_FILE__
void Solve() {
int L = 1;
int R = 1e6;
int last = -100;
OUT('?', last);
while (L < R) {
int M = midpoint(L, R);
// [L, M], [M+1, R]
int nxt = (2 * M + 1) - last;
OUT('?', nxt);
int res;
IN(res);
if (last < L) {
if (res == 0) {
R = M;
} else {
L = M + 1;
}
} else if (R < last) {
if (res == 0) {
L = M + 1;
} else {
R = M;
}
} else {
assert(false);
}
last = nxt;
}
OUT('!', L);
}
int main() {
ios::sync_with_stdio(false);
Solve();
}
#elif __INCLUDE_LEVEL__ == 1
#include <bits/stdc++.h>
template <class T> concept MyRange = std::ranges::range<T> && !std::convertible_to<T, std::string_view>;
template <class T> concept MyTuple = std::__is_tuple_like<T>::value && !MyRange<T>;
namespace std {
istream& operator>>(istream& is, MyRange auto&& r) {
for (auto&& e : r) is >> e;
return is;
}
istream& operator>>(istream& is, MyTuple auto&& t) {
apply([&](auto&... xs) { (is >> ... >> xs); }, t);
return is;
}
ostream& operator<<(ostream& os, MyRange auto&& r) {
auto sep = "";
for (auto&& e : r) os << exchange(sep, " ") << e;
return os;
}
ostream& operator<<(ostream& os, MyTuple auto&& t) {
auto sep = "";
apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t);
return os;
}
} // namespace std
using namespace std;
#define IN(...) (cin >> forward_as_tuple(__VA_ARGS__))
#define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n')
#endif // __INCLUDE_LEVEL__ == 1
risujiroh