結果

問題 No.1429 Simple Dowsing
ユーザー 👑 kmjpkmjp
提出日時 2021-03-20 11:55:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,053 bytes
コンパイル時間 2,005 ms
コンパイル使用メモリ 198,900 KB
実行使用メモリ 24,408 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:15:35
合計ジャッジ時間 3,512 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
24,240 KB
testcase_01 AC 27 ms
23,556 KB
testcase_02 AC 27 ms
24,240 KB
testcase_03 AC 26 ms
23,544 KB
testcase_04 AC 26 ms
23,628 KB
testcase_05 AC 26 ms
24,324 KB
testcase_06 AC 26 ms
24,348 KB
testcase_07 AC 26 ms
23,400 KB
testcase_08 AC 25 ms
24,408 KB
testcase_09 AC 26 ms
23,676 KB
testcase_10 AC 25 ms
24,024 KB
testcase_11 AC 25 ms
24,300 KB
testcase_12 AC 26 ms
23,568 KB
testcase_13 AC 25 ms
23,436 KB
testcase_14 AC 26 ms
24,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cout<<"? 0 0"<<endl;
	cin>>A;
	cout<<"? 1 0"<<endl;
	cin>>B;
	FOR(x,101) FOR(y,101) {
		if(x*x+y*y!=A) continue;
		if((x-1)*(x-1)+y*y!=B) continue;
		cout<<"! "<<x<<" "<<y<<endl;
		return;
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0