結果
問題 | No.2962 Sum Bomb Bomber |
ユーザー |
|
提出日時 | 2024-11-20 23:42:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,472 bytes |
コンパイル時間 | 3,399 ms |
コンパイル使用メモリ | 259,552 KB |
実行使用メモリ | 25,704 KB |
平均クエリ数 | 1083.54 |
最終ジャッジ日時 | 2024-11-20 23:42:17 |
合計ジャッジ時間 | 14,804 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 64 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for(int i=0; i<n; i++)#define debug 0#define YES cout << "Yes" << endl;#define NO cout << "No" << endl;using ll = long long;using ld = long double;const int mod = 998244353;const int MOD = 1000000007;const double pi = atan2(0, -1);const int inf = 1 << 31 - 1;const ll INF = 1LL << 63 - 1;#include <time.h>#include <chrono>//vectorの中身を空白区切りで出力template<typename T>void printv(vector<T> v) {for (int i = 0; i < v.size(); i++) {cout << v[i];if (i < v.size() - 1) {cout << " ";}}cout << endl;}//vectorの中身を改行区切りで出力template<typename T>void print1(vector<T> v) {for (auto x : v) {cout << x << endl;}}//二次元配列を出力template<typename T>void printvv(vector<vector<T>> vv) {for (vector<T> v : vv) {printv(v);}}//vectorを降順にソートtemplate<typename T>void rsort(vector<T>& v) {sort(v.begin(), v.end());reverse(v.begin(), v.end());}//昇順priority_queueを召喚template<typename T>struct rpriority_queue {priority_queue<T, vector<T>, greater<T>> pq;void push(T x) {pq.push(x);}void pop() {pq.pop();}T top() {return pq.top();}size_t size() {return pq.size();}bool empty() {return pq.empty();}};//mod mod下で逆元を算出する//高速a^n計算(mod ver.)ll power(ll a, ll n) {if (n == 0) {return 1;}else if (n % 2 == 0) {ll x = power(a, n / 2);x *= x;x %= mod;return x;}else {ll x = power(a, n - 1);x *= a;x %= mod;return x;}}//フェルマーの小定理を利用ll modinv(ll p) {return power(p, mod - 2) % mod;}//Mexを求めるstruct Mex {map<int, int> mp;set<int> s;Mex(int Max) {for (int i = 0; i <= Max; i++) {s.insert(i);}}int _mex = 0;void Input(int x) {mp[x]++;s.erase(x);if (_mex == x) {_mex = *begin(s);}}void Remove(int x) {if (mp[x] == 0) {cout << "Mex ERROR!: NO VALUE WILL BE REMOVED" << endl;}mp[x]--;if (mp[x] == 0) {s.insert(x);if (*begin(s) == x) {_mex = x;}}}int mex() {return _mex;}};//条件分岐でYes/Noを出力するタイプのやつvoid YN(bool true_or_false) {cout << (true_or_false ? "Yes" : "No") << endl;}//Union-Findstruct UnionFind {vector<int> par;UnionFind(int N) : par(N) {for (int i = 0; i < N; i++) {par[i] = -1;}}//root(x):xの根を求める関数int root(int x) {if (par[x] == -1) {return x;}else {return par[x] = root(par[x]);}}//isSame(x,y):xとyが同じグループならtrueを返す関数bool isSame(int x, int y) {if (root(x) == root(y)) {return true;}else {return false;}}//Union(x,y):xとyの根をつなげる関数void Union(int x, int y) {int X = root(x);int Y = root(y);if (X == Y) {return;}if (X < Y) {swap(X, Y);}par[X] = Y;}};//最大公約数(ユークリッドの互除法)ll gcd(ll a, ll b) {if (b > a) {swap(a, b);}while (a % b != 0) {ll t = a;a = b;b = t % b;}return b;}//最小公倍数(gcdを定義しておく)ll lcm(ll a, ll b) {ll g = gcd(a, b);ll x = (a / g) * b;return x;}vector<ll> faq(int type, vector<ll> x, vector<ll> y) {if (abs(x[0] - y[0]) == 1) {if (x[1] <= y[1]) {return x;}else {return y;}}ll mid = (x[0] + y[0]) / 2;vector<ll> z;ll d;if (type == 0) {cout << "1 " << mid << " " << 0 << endl;;}if(type==1) {cout << "1 0 " << mid << endl;}cin >> d;z = { mid, d };if (z[1] == x[1]) {return faq(type, x, z);}else if (z[1] == y[1]) {return faq(type, z, y);}else if (x[1] > z[1] && z[1] > y[1]) {return faq(type, z, y);}else if (x[1] < z[1] && z[1] < y[1]) {return faq(type, x, z);}else {vector<ll> a = faq(type, x, z), b = faq(type, z, y);if (a[1] <= b[1]) {return a;}else {return b;}}}int main(){int N;cin >> N;vector<ll> x1 = { -1000000000, 0 }, x2 = { 1000000000,0 }, y1 = { -1000000000,0 }, y2 = {1000000000,0};cout << "1 -100000001 0" << endl;cin >> x1[1];cout << "1 100000001 0" << endl;cin >> x2[1];cout << "1 0 -100000001" << endl;cin >> y1[1];cout << "1 0 100000001" << endl;cin >> y2[1];vector<ll> xmin, ymin;xmin = faq(0, x1, x2);ymin = faq(1, y1, y2);cout << "2 " << xmin[0] << " " << ymin[0] << endl;}