結果
| 問題 | 
                            No.513 宝探し2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tac
                         | 
                    
| 提出日時 | 2019-07-31 21:15:25 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,768 bytes | 
| コンパイル時間 | 1,880 ms | 
| コンパイル使用メモリ | 178,172 KB | 
| 実行使用メモリ | 44,580 KB | 
| 平均クエリ数 | 1.50 | 
| 最終ジャッジ日時 | 2024-07-16 17:50:57 | 
| 合計ジャッジ時間 | 6,011 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 TLE * 1 -- * 5 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    map<pii, int> mp;
    int x = 0, y = 0;
    int m;
    while (1) {
        cout << x << " " << y << endl;
        cin >> m;
        if (m == 0) break;
        rep(i, 100000) {
            int b = m - abs(x - i);
            if (b < 0 || b > 100000) continue;
            vector<int> v;
            int j = y - b;
            if (j >= 0 && j <= 100000) v.eb(j);
            int j2 = y + b;
            if (j2 >= 0 && j2 <= 100000 && j != j2) v.eb(j2);
            rep(j, SZ(v)) {
                if (x == 0 && y == 0) {
                    mp[{i, v[j]}]++;
                } else {
                    if (mp[{i, v[j]}] == 1) mp[{i, v[j]}]++;
                }
            }
        }
        if (!(x == 0 && y == 0)) {
            for (auto e : mp) {
                if (e.S == 1) mp[{e.F.F, e.F.S}] = 0;
                else if (e.S == 2) mp[{e.F.F, e.F.S}] = 1;
                // out(e.F.F << " " << e.F.S << " " << e.S);
            }
        }
        for (auto e : mp) {
            if (e.S == 0) continue;
            // out(e.F.F << " " << e.F.S << " " << e.S);
            x = e.F.F;
            y = e.F.S;
            break;
        }
    }
}
            
            
            
        
            
tac