結果

問題 No.594 壊れた宝物発見機
ユーザー LapinponLapinpon
提出日時 2017-11-11 00:01:06
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 965 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 59,868 KB
実行使用メモリ 43,984 KB
最終ジャッジ日時 2023-09-23 15:44:02
合計ジャッジ時間 6,884 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 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:45: warning: ‘check’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       for(int i=0;i<3;i++) a[i]=xyz[i][check];
                                 ~~~~~~~~~~~~^

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace	std;
int main(){

  int a[3];
  int xyz[3][8];
  xyz[0][0]=xyz[0][3]=xyz[0][4]=xyz[0][7]=-100;
  xyz[0][1]=xyz[0][2]=xyz[0][5]=xyz[0][6]=100;
  xyz[1][0]=xyz[1][1]=xyz[1][2]=xyz[1][3]=100;
  xyz[1][4]=xyz[1][5]=xyz[1][6]=xyz[1][7]=-100;
  xyz[2][0]=xyz[2][1]=xyz[2][4]=xyz[2][5]=-100;
  xyz[2][2]=xyz[2][3]=xyz[2][6]=xyz[2][7]=100;
  for(;;){
    long long ans[8],inf=1e15;
    for(int i=0;i<8;i++){
      cout<<"?";
      for(int j=0;j<3;j++) cout<<" "<<xyz[j][i];
      cin>>ans[i];
    }
    int check;
    for(int i=0;i<8;i++){
      if(inf>ans[i]){
        inf=ans[i];
        check=i;
      }
    }
    if(abs(xyz[0][0]-xyz[0][1])<=1){
      for(int i=0;i<3;i++) a[i]=xyz[i][check];
      break;
    }
    for(int i=0;i<3;i++) for(int j=0;j<8;j++) xyz[i][j]=xyz[i][j]-(xyz[i][j]-xyz[i][check])/2;
  }
  cout<<"!";
  for(int i=0;i<3;i++) cout<<" "<<a[i];
  cout<<endl;
  return 0;

}
0