結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
24,348 KB
testcase_01 AC 26 ms
23,472 KB
testcase_02 AC 24 ms
23,628 KB
testcase_03 AC 26 ms
24,144 KB
testcase_04 AC 25 ms
24,024 KB
testcase_05 AC 25 ms
24,432 KB
testcase_06 AC 26 ms
24,336 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 27 ms
23,436 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 26 ms
24,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:34:34: 警告: ‘xb’ may be used uninitialized [-Wmaybe-uninitialized]
   34 |     cout << "? " << xa << " " << xb << endl;
      |                                  ^~
main.cpp:23:17: 備考: ‘xb’ はここで定義されています
   23 |     int32_t xa, xb;
      |                 ^~
main.cpp:34:27: 警告: ‘xa’ may be used uninitialized [-Wmaybe-uninitialized]
   34 |     cout << "? " << xa << " " << xb << endl;
      |                           ^~~
main.cpp:23:13: 備考: ‘xa’ はここで定義されています
   23 |     int32_t xa, xb;
      |             ^~

ソースコード

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;
    int32_t xa, xb;
    for (auto a = 0; a <= 100; ++a) {
        for (auto b = 0; b <= 100; ++b) {
            if (a * a + b * b == d) {
                xa = a;
                xb = b;
                goto next;
            }
        }
    }
next:
    cout << "? " << xa << " " << xb << endl;
    cin >> d;
    if (d != 0)
        swap(xa, xb);
    cout << "! " << xa << " " << xb << endl;
    return 0;
}
0