結果
問題 | No.1429 Simple Dowsing |
ユーザー | ぷら |
提出日時 | 2021-03-14 14:36:33 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 1,415 ms |
コンパイル使用メモリ | 168,884 KB |
実行使用メモリ | 24,216 KB |
平均クエリ数 | 2.93 |
最終ジャッジ日時 | 2023-09-24 10:04:37 |
合計ジャッジ時間 | 2,810 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
23,508 KB |
testcase_01 | AC | 24 ms
23,364 KB |
testcase_02 | AC | 24 ms
24,000 KB |
testcase_03 | AC | 24 ms
23,412 KB |
testcase_04 | AC | 24 ms
24,216 KB |
testcase_05 | AC | 25 ms
23,652 KB |
testcase_06 | AC | 24 ms
24,204 KB |
testcase_07 | AC | 23 ms
24,108 KB |
testcase_08 | AC | 23 ms
24,036 KB |
testcase_09 | AC | 23 ms
24,000 KB |
testcase_10 | AC | 22 ms
23,628 KB |
testcase_11 | AC | 22 ms
23,652 KB |
testcase_12 | AC | 23 ms
23,640 KB |
testcase_13 | AC | 24 ms
23,376 KB |
testcase_14 | AC | 24 ms
24,108 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cout << "? 0 0" << endl; int a; cin >> a; if(a == 0) { cout << "! 0 0" << endl; return 0; } vector<pair<int,int>>tmp; for(int i = 0; i <= 100; i++) { for(int j = 0; j <= 100; j++) { if(i*i+j*j == a) { tmp.push_back({i,j}); } } } cout << "? " << tmp[0].first << " " << tmp[0].second << endl; int b; cin >> b; if(b == 0) { cout << "! " << tmp[0].first << " " << tmp[0].second << endl; return 0; } for(int i = 0; i <= 100; i++) { for(int j = 0; j <= 100; j++) { if(i*i+j*j == a && abs(tmp[0].first-i)*abs(tmp[0].first-i)+abs(tmp[0].second-j)*abs(tmp[0].second-j) == b) { cout << "! " << i << " " << j << endl; return 0; } } } }