結果
| 問題 | 
                            No.513 宝探し2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lapi
                         | 
                    
| 提出日時 | 2019-03-31 19:06:44 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,460 bytes | 
| コンパイル時間 | 1,034 ms | 
| コンパイル使用メモリ | 103,380 KB | 
| 実行使用メモリ | 40,528 KB | 
| 最終ジャッジ日時 | 2024-07-16 16:50:31 | 
| 合計ジャッジ時間 | 7,523 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 11 | 
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int up = 100001;
	int bottom = -1;
	int left = -1;
	int right = 100001;
	int ld, rd;
	
	
	cout << left << " " << bottom << endl; cin >> ld;
	cout << right << " " << bottom << endl; cin >> rd;
	while (true) {
		if (ld == rd) {
			int tmp= (left + right) / 2;
			left = right = tmp;
			break;
		}
		else if (ld < rd) {
			right = (left + right) / 2;
			cout << right << " " << bottom << endl; cin >> rd;
		}
		else { // rd < ld
			left = (left + right) / 2 + 1;
			cout << left << " " << bottom << endl; cin >> ld;
		}
	}
	int ud, bd;
	cout << left << " " << bottom << endl; cin >> bd;
	cout << left << " " << up << endl; cin >> ud;
	
	bool flag = false;
	while (!flag) {
		if (bd == ud) {
			cout << left << " " << (bd + ud) / 2;
			flag = true;
		}
		else if (bd < ud) {
			up = (bottom + up) / 2;
			cout << left << " " << up << endl; cin >> ud;
			if (ud == 0) flag = true;
		}
		else { // rd < ld
			bottom = (bottom + up) / 2 + 1;
			cout << left << " " << bottom << endl; cin >> bd;
		}
	}
	return 0;
}
            
            
            
        
            
lapi