結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
torith
|
| 提出日時 | 2017-07-11 11:45:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,207 bytes |
| コンパイル時間 | 1,608 ms |
| コンパイル使用メモリ | 159,920 KB |
| 実行使用メモリ | 40,016 KB |
| 最終ジャッジ日時 | 2024-07-17 01:17:11 |
| 合計ジャッジ時間 | 8,140 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:57:17: warning: ‘min’ may be used uninitialized in this function [-Wmaybe-uninitialized]
57 | if(min > d){
| ^~
ソースコード
/*
* 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;
}
torith