結果

問題 No.513 宝探し2
ユーザー torithtorith
提出日時 2017-07-11 11:45:31
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,207 bytes
コンパイル時間 1,127 ms
コンパイル使用メモリ 144,952 KB
実行使用メモリ 36,248 KB
最終ジャッジ日時 2023-09-24 01:22:09
合計ジャッジ時間 7,730 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:57:3: warning: ‘min’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(min > d){
   ^~

ソースコード

diff #

/*
 * 513.cpp
 */

//include files
#include<bits/stdc++.h>
#include<utility>


using namespace std;

//DEFINE MACROS
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define PRINTLN(s) cout << s << endl

//DEFINE CONSTANT
#define MAX_LEN 100000

//DEFINE PROTOTYPE

int main(){
  int count = 0;
  pair <int ,int > start = make_pair(0,0);
  while(1){
	pair <int ,int > query = make_pair(0,0);;
	pair <int , int> minquery = make_pair(0,0);;
	int min;
	for (int i = 0; i < 4; ++i) {
	  if(count > 100 ){
		cout << "error" << "\n";
		return -1;		
	  }
	  int side = MAX_LEN/(count+1);
	  switch(i){
	  case 1:
		query = make_pair(start.first+side/2,start.first+side);
		break;
	  case 2:
		query = make_pair(side+start.first+side/2,start.first+side);
		break;
	  case 3:
		query = make_pair(start.first+side/2,side+start.first+side);
		break;
	  case 4:
		query = make_pair(side+start.first+side/2,side+start.first+side);
		break;	
	  }
	  cout << query.first << " "<< query.second << "\n";
	  int d;
	  cin >> d;
	  if(d ==0 ) return 0;
	  if(d<side){
		minquery = query;
		break;
	  }else{
		if(min > d){
		  min = d;
		  minquery = query;
		}
	  }
	  count++;
	}
	start = minquery;	
  }
  return 0;
}


0