結果

問題 No.594 壊れた宝物発見機
ユーザー snrnsidysnrnsidy
提出日時 2023-04-09 12:14:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 3,314 bytes
コンパイル時間 2,789 ms
コンパイル使用メモリ 354,452 KB
実行使用メモリ 25,488 KB
平均クエリ数 86.00
最終ジャッジ日時 2024-10-04 13:37:21
合計ジャッジ時間 6,249 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
25,220 KB
testcase_01 AC 103 ms
25,220 KB
testcase_02 AC 100 ms
24,836 KB
testcase_03 AC 103 ms
25,208 KB
testcase_04 AC 100 ms
24,836 KB
testcase_05 AC 104 ms
25,220 KB
testcase_06 AC 102 ms
25,192 KB
testcase_07 AC 104 ms
25,220 KB
testcase_08 AC 102 ms
24,836 KB
testcase_09 AC 99 ms
24,592 KB
testcase_10 AC 99 ms
25,232 KB
testcase_11 AC 100 ms
24,976 KB
testcase_12 AC 104 ms
24,464 KB
testcase_13 AC 103 ms
25,488 KB
testcase_14 AC 103 ms
24,848 KB
testcase_15 AC 104 ms
24,848 KB
testcase_16 AC 110 ms
24,848 KB
testcase_17 AC 102 ms
24,976 KB
testcase_18 AC 101 ms
25,232 KB
testcase_19 AC 102 ms
24,592 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:162:15: warning: 'res[0]' may be used uninitialized [-Wmaybe-uninitialized]
  162 |         answer(res[0],res[1],res[2]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:72:13: note: 'res[0]' was declared here
   72 |         int res[3];
      |             ^~~
main.cpp:162:15: warning: 'res[1]' may be used uninitialized [-Wmaybe-uninitialized]
  162 |         answer(res[0],res[1],res[2]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:72:13: note: 'res[1]' was declared here
   72 |         int res[3];
      |             ^~~
main.cpp:162:15: warning: 'res[2]' may be used uninitialized [-Wmaybe-uninitialized]
  162 |         answer(res[0],res[1],res[2]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:72:13: note: 'res[2]' was declared here
   72 |         int res[3];
      |             ^~~

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")	
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping") 
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma") 
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") 
//#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

// 질문 쿼리
int ask (int x, int y, int z) {
	int d;
	cout << "?" << " " << x << " " << y << " " << z << endl;
	cin >> d;
	return d;
}

// 답변 쿼리
void answer(int x, int y, int z) {
	cout << "!" << " " << x << " " << y << " " << z << endl;
}

int main(void)
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);

	int res[3];

	int x = 150;
	int y = 150;
	int z = 150;

	int lo = -150;
	int hi = 150;

	while(hi-lo >= 3)
	{
		int p = (lo*2 + hi)/3, q = (lo + hi*2)/3;
		if(ask(x,y,p) <= ask(x,y,q))
		{
			hi = q;
		}
		else
		{
			lo = p;
		}
	}

	int val = 1e9;

	for(int i=lo;i<=hi;i++)
	{
		int xx = ask(x,y,i);
		if(xx < val)
		{
			val = xx;
			res[2] = i;
		}
	}

	lo = -150;
	hi = 150;

	while(hi-lo >= 3)
	{
		int p = (lo*2 + hi)/3, q = (lo + hi*2)/3;
		if(ask(x,p,z) <= ask(x,q,z))
		{
			hi = q;
		}
		else
		{
			lo = p;
		}
	}

	val = 1e9;

	for(int i=lo;i<=hi;i++)
	{
		int xx = ask(x,i,z);
		if(xx < val)
		{
			val = xx;
			res[1] = i;
		}
	}

	lo = -150;
	hi = 150;

	while(hi-lo >= 3)
	{
		int p = (lo*2 + hi)/3, q = (lo + hi*2)/3;
		if(ask(p,y,z) <= ask(q,y,z))
		{
			hi = q;
		}
		else
		{
			lo = p;
		}
	}

	val = 1e9;

	for(int i=lo;i<=hi;i++)
	{
		int xx = ask(i,y,z);
		if(xx < val)
		{
			val = xx;
			res[0] = i;
		}
	}

	answer(res[0],res[1],res[2]);
	
    return 0;   
}   
0