結果
問題 |
No.1429 Simple Dowsing
|
ユーザー |
![]() |
提出日時 | 2021-03-28 01:15:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 537 bytes |
コンパイル時間 | 1,553 ms |
コンパイル使用メモリ | 172,168 KB |
実行使用メモリ | 25,464 KB |
平均クエリ数 | 3.00 |
最終ジャッジ日時 | 2024-07-17 11:05:48 |
合計ジャッジ時間 | 2,876 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int d1, d2; cout << "? 0 0" << endl; cin >> d1; typedef pair<int, int> P; vector<P> v; for( int i = 0; i <= 100; i++ ) { for( int j = 0; j <= 100; j++ ) { if( i * i + j * j == d1 ) { v.push_back( P( i, j ) ); } } } cout << "? 0 100" << endl; cin >> d2; int N = v.size(); for( int i = 0; i < N; i++ ) { int x, y; tie( x, y ) = v[i]; int yy = y - 100; if( x * x + yy * yy == d2 ) { cout << "! " << x << " " << y << endl; return 0; } } }