結果
問題 |
No.2962 Sum Bomb Bomber
|
ユーザー |
![]() |
提出日時 | 2024-11-16 15:59:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,763 bytes |
コンパイル時間 | 3,152 ms |
コンパイル使用メモリ | 246,528 KB |
実行使用メモリ | 25,464 KB |
平均クエリ数 | 213.68 |
最終ジャッジ日時 | 2024-11-16 16:01:32 |
合計ジャッジ時間 | 14,391 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 1 WA * 63 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n) - 1; i >= 0; --i) #define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair<int,int> template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } template<typename T, typename U> U Ternarysearch(T l, T r, const std::function<U(T)> &f) { // 下に凸 while (2 < abs(r - l)) { T ml = (l * 2 + r) / 3; T mr = (l + r * 2) / 3; if (f(ml) < f(mr)) r = mr; else l = ml; } T ret = l; U value = f(l); for (T i = l; i <= r; ++i) value = std::min(value, f(i)); return value; } auto query(int x, int y) { std::cout << 1 << " " << x << " " << y; std::cout << std::endl; fflush(stdout); long long get; std::cin >> get; return get; } auto answer(int x, int y) { std::cout << 2 << " " << x << " " << y; std::cout << std::endl; fflush(stdout); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; auto f = [&](int x)->long long { return query(x, 0); }; int x = Ternarysearch<int, long long>(-1e9, 1e9, f); auto g = [&](int y)->long long { return query(0, y); }; int y = Ternarysearch<int, long long>(-1e9, 1e9, g); answer(x, y); return 0; }