結果

問題 No.513 宝探し2
ユーザー ShibuyapShibuyap
提出日時 2020-02-22 00:53:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,335 bytes
コンパイル時間 1,799 ms
コンパイル使用メモリ 169,580 KB
実行使用メモリ 24,228 KB
平均クエリ数 13.25
最終ジャッジ日時 2023-09-23 19:43:17
合計ジャッジ時間 2,866 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,964 KB
testcase_01 AC 29 ms
23,568 KB
testcase_02 AC 29 ms
23,400 KB
testcase_03 AC 28 ms
23,412 KB
testcase_04 AC 28 ms
23,988 KB
testcase_05 AC 28 ms
24,216 KB
testcase_06 AC 28 ms
23,328 KB
testcase_07 AC 29 ms
23,988 KB
testcase_08 AC 28 ms
23,364 KB
testcase_09 AC 26 ms
24,228 KB
testcase_10 AC 28 ms
23,988 KB
testcase_11 AC 27 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    srand((unsigned) time(NULL));
    int x[10], y[10];
    rep(i,10){
        x[i] = rand() % 99999;
        y[i] = rand() % 99999;
    
    }

    int a[10] = {};
    rep(i,10){
        cout << x[i] << ' ' << y[i] << endl;
        cin >> a[i];
        if(a[i] == 0)return 0;
    }

    vector<P> v;
    srep(i, x[0]-a[0], x[0]+a[0]){
        int j = y[0] - (a[0] - abs(x[0] - i));
        if(i >= 0 && i <= 100000 && j >= 0 && j <= 100000){
            v.push_back(P(i,j));
        }
        j = y[0] + (a[0] - abs(x[0] - i));
        if(i >= 0 && i <= 100000 && j >= 0 && j <= 100000){
            v.push_back(P(i,j));
        }
    }

    rep(loop, v.size()){
        int l = v[loop].first;
        int r = v[loop].second;
        int flag = 1;
        rep(i,10){
            if(abs(l - x[i]) + abs(r - y[i]) != a[i])flag = 0;
        }
        if(flag){
            cout << l << ' ' << r << endl;
            int d;
            cin >> d;
            if(d == 0)return 0;
        }
    }
    
    return 0;
}
 
 
0