結果
問題 | No.2962 Sum Bomb Bomber |
ユーザー |
![]() |
提出日時 | 2024-11-18 12:11:46 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 996 bytes |
コンパイル時間 | 7,898 ms |
コンパイル使用メモリ | 262,340 KB |
最終ジャッジ日時 | 2025-02-25 05:25:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 62 WA * 2 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){cin.tie(nullptr);ios_base::sync_with_stdio(false);/*凹関数なので三分探索*/ll N, ansx, cnt;cin >> N;map<pair<ll, ll>, ll> mp;auto f=[&](ll x, ll y){ll res;if (mp.count({x, y})) return mp[{x, y}];cout << 1 << " " << x << " " << y << endl;cin >> res;cnt++;assert(cnt <= 300);return mp[{x, y}] = res;};//r=l,l+1, l+2のいずれか//X方向ll l=-1e8, r=1e8+1, cl, cr;while(r-l>2){cl = l+(r-l)/3; cr = l+(r-l)*2/3;if (f(cl, 0) > f(cr, 0)) l = cl;else r = cr;}ansx = (l+r)/2;//Y方向l=-1e8; r=1e8+1;while(r-l>2){assert(l<r);cl = l+(r-l)/3; cr = l+(r-l)*2/3;if (f(0, cl) > f(0, cr)) l = cl;else r = cr;}cout << 2 << " " << ansx << " " << (l+r)/2 << endl;return 0;}