結果

問題 No.1429 Simple Dowsing
ユーザー ooooobaoooooba
提出日時 2021-07-18 12:31:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 892 bytes
コンパイル時間 1,077 ms
コンパイル使用メモリ 118,772 KB
実行使用メモリ 24,564 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 12:11:50
合計ジャッジ時間 2,502 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,424 KB
testcase_01 AC 23 ms
23,880 KB
testcase_02 AC 22 ms
23,712 KB
testcase_03 WA -
testcase_04 AC 24 ms
23,508 KB
testcase_05 AC 22 ms
23,220 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 21 ms
24,168 KB
testcase_09 AC 22 ms
24,108 KB
testcase_10 AC 22 ms
24,144 KB
testcase_11 AC 23 ms
23,376 KB
testcase_12 WA -
testcase_13 AC 22 ms
23,484 KB
testcase_14 AC 23 ms
24,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    cout << "? 0 0" << endl;
    int32_t d;
    cin >> d;
    vector<pair<int32_t, int32_t>> cand;
    for (auto a = 0; a <= 100; ++a) {
        for (auto b = 0; b <= 100; ++b) {
            if (a * a + b * b == d) {
                cand.push_back({a, b});
            }
        }
    }
    cout << "? 100 100" << endl;
    cin >> d;
    for (auto &&p : cand) {
        int32_t ta = 100 - p.first, tb = 100 - p.second;
        if (ta * ta + tb * tb == d) {
            cout << "! " << p.first << " " << p.second << endl;
            break;
        }
    }
    return 0;
}
0