結果
| 問題 |
No.513 宝探し2
|
| ユーザー |
vvataarne
|
| 提出日時 | 2017-05-05 23:01:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 1,828 bytes |
| コンパイル時間 | 1,844 ms |
| コンパイル使用メモリ | 166,864 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 58.67 |
| 最終ジャッジ日時 | 2024-07-17 01:00:53 |
| 合計ジャッジ時間 | 2,976 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
// clang-format off
#include <bits/stdc++.h>
#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))
#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
using namespace std;
// clang-format on
main {
int x1 = 0, x2 = 100000, y1 = 0, y2 = 100000;
int x;
while (true) {
int t, s;
cout << x1 << ' ' << 0 << endl;
cin >> t;
cout << x2 << ' ' << 0 << endl;
cin >> s;
if (x2 - x1 == 1) {
x = t < s ? x1 : x2;
break;
}
if (t == s) {
x = x1 + (x2 - x1) / 2;
break;
}
if (t < s) {
x2 = x1 + (x2 - x1 + 1) / 2;
continue;
}
if (t > s) {
x1 = x1 + (x2 - x1) / 2;
continue;
}
}
int y;
while (true) {
int t, s;
cout << 0 << ' ' << y1 << endl;
cin >> t;
cout << 0 << ' ' << y2 << endl;
cin >> s;
if (y2 - y1 == 1) {
y = t < s ? y1 : y2;
break;
}
if (t == s) {
y = y1 + (y2 - y1) / 2;
break;
}
if (t < s) {
y2 = y1 + (y2 - y1 + 1) / 2;
continue;
}
if (t > s) {
y1 = y1 + (y2 - y1) / 2;
continue;
}
}
cout << x << ' ' << y << endl;
bye;
}
vvataarne