結果
問題 | No.1429 Simple Dowsing |
ユーザー |
![]() |
提出日時 | 2021-03-14 14:36:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 1,625 ms |
コンパイル使用メモリ | 171,408 KB |
実行使用メモリ | 25,336 KB |
平均クエリ数 | 2.93 |
最終ジャッジ日時 | 2024-07-17 10:51:38 |
合計ジャッジ時間 | 3,116 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
#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; } } } }