結果

問題 No.594 壊れた宝物発見機
ユーザー kotatsugamekotatsugame
提出日時 2019-10-12 18:40:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 718 ms
コンパイル使用メモリ 67,116 KB
実行使用メモリ 24,252 KB
平均クエリ数 76.90
最終ジャッジ日時 2023-09-23 18:17:06
合計ジャッジ時間 4,176 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
23,316 KB
testcase_01 AC 110 ms
23,964 KB
testcase_02 AC 110 ms
23,676 KB
testcase_03 AC 110 ms
24,048 KB
testcase_04 AC 108 ms
23,652 KB
testcase_05 AC 108 ms
23,292 KB
testcase_06 AC 107 ms
23,544 KB
testcase_07 AC 108 ms
23,328 KB
testcase_08 AC 109 ms
23,688 KB
testcase_09 AC 109 ms
23,448 KB
testcase_10 AC 108 ms
24,072 KB
testcase_11 AC 111 ms
23,544 KB
testcase_12 AC 109 ms
23,424 KB
testcase_13 AC 110 ms
23,304 KB
testcase_14 AC 111 ms
23,400 KB
testcase_15 AC 110 ms
24,252 KB
testcase_16 AC 112 ms
24,252 KB
testcase_17 AC 111 ms
23,292 KB
testcase_18 AC 113 ms
23,568 KB
testcase_19 AC 113 ms
24,252 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   10 | main()
      | ^~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:28:25: 警告: ‘Y’ is used uninitialized [-Wuninitialized]
   28 |         int Y=f(X,L,0)>f(Y,R,0)?R:L;
      |                        ~^~~~~~~
main.cpp:28:13: 備考: ‘Y’ はここで定義されています
   28 |         int Y=f(X,L,0)>f(Y,R,0)?R:L;
      |             ^

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int f(int x,int y,int z)
{
	cout<<"? "<<x<<" "<<y<<" "<<z<<endl;
	int ans;cin>>ans;
	return ans;
}
main()
{
	int L=-101,R=101;
	while(R-L>2)
	{
		int M1=(L+L+R)/3,M2=(L+R+R)/3;
		if(f(M1,0,0)>f(M2,0,0))L=M1;
		else R=M2;
	}
	int X=f(L,0,0)>f(R,0,0)?R:L;
	X=L+R>>1;
	L=-101,R=101;
	while(R-L>2)
	{
		int M1=(L+L+R)/3,M2=(L+R+R)/3;
		if(f(X,M1,0)>f(X,M2,0))L=M1;
		else R=M2;
	}
	int Y=f(X,L,0)>f(Y,R,0)?R:L;
	Y=L+R>>1;
	L=-101,R=101;
	while(R-L>2)
	{
		int M1=(L+L+R)/3,M2=(L+R+R)/3;
		if(f(X,Y,M1)>f(X,Y,M2))L=M1;
		else R=M2;
	}
	int Z=f(X,Y,L)>f(X,Y,R)?R:L;
	Z=L+R>>1;
	cout<<"! "<<X<<" "<<Y<<" "<<Z<<endl;
}
0