結果

問題 No.513 宝探し2
ユーザー tsutajtsutaj
提出日時 2017-05-05 23:20:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,988 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 98,364 KB
実行使用メモリ 25,604 KB
平均クエリ数 112.33
最終ジャッジ日時 2024-07-16 13:25:13
合計ジャッジ時間 3,264 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 24 ms
24,964 KB
testcase_02 AC 24 ms
25,220 KB
testcase_03 WA -
testcase_04 AC 23 ms
24,836 KB
testcase_05 AC 22 ms
25,220 KB
testcase_06 AC 23 ms
24,824 KB
testcase_07 AC 22 ms
24,836 KB
testcase_08 AC 21 ms
25,220 KB
testcase_09 AC 21 ms
24,964 KB
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:128:26:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'ay' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:72:13: note: 'ay' was declared here
   72 |     int ax, ay, mx = INF, my = INF;
      |             ^~
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:105:17:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'ax' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:72:9: note: 'ax' was declared here
   72 |     int ax, ay, mx = INF, my = INF;
      |         ^~

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int ubx = 100000, lbx = 0, uby = 100000, lby = 0;
    int ax, ay, mx = INF, my = INF;

    while(ubx - lbx > 3) {
        int l = (ubx + 2*lbx) / 3;
        int r = (2*ubx + lbx) / 3;
        int kl, kr;
        cout << l << " " << 0 << endl;
        cin >> kl;
        cout << r << " " << 0 << endl;
        cin >> kr;
        if(kl < kr) {
            ubx = r;
        }
        else {
            lbx = l;
        }
    }

    int idx = lbx, inp;
    while(idx <= ubx) {
        cout << idx << " " << 0 << endl;
        cin >> inp;
        if(mx > inp) {
            mx = inp;
            ax = idx;
        }
        idx++;
    }

    while(uby - lby > 3) {
        int r = (2*uby + lby) / 3;
        int l = (uby + 2*lby) / 3;
        int kl, kr;
        cout << ax << " " << l << endl;
        cin >> kl;
        cout << ax << " " << r << endl;
        cin >> kr;
        if(kl < kr) {
            uby = r;
        }
        else {
            lby = l;
        }
    }

    idx = lby;
    while(idx <= uby) {
        cout << ax << " " << idx << endl;
        cin >> inp;
        if(my > inp) {
            my = inp;
            ay = idx;
        }
        idx++;
    }
    int ans;
    cout << ax << " " << ay << endl;
    cin >> ans;
    return 0;
}
0