結果

問題 No.2357 Guess the Function
ユーザー tsugutsugutsugutsugu
提出日時 2023-06-23 21:38:55
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 2,868 ms
コンパイル使用メモリ 248,692 KB
実行使用メモリ 24,348 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-13 16:38:24
合計ジャッジ時間 4,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,192 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 23 ms
23,364 KB
testcase_04 AC 23 ms
23,364 KB
testcase_05 AC 23 ms
23,628 KB
testcase_06 AC 23 ms
23,604 KB
testcase_07 AC 24 ms
24,312 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 24 ms
24,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 1
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    auto Ask = [&] (int x) {
        cout << "? " << x << endl;
        int ret;
        cin >> ret;
        return ret;
    };
    int y1 = Ask(100);
    vector<pair<int, int>> can;
    for (int a = 0; a < 100; a++) {
        for (int b = a + 1; b <= 100; b++) {
            if ((a + 100) % b == y1) {
                can.push_back(make_pair(a, b));
            }
        }
    }
    for (int i = 1; i <= 100; i++) {
        vector<int> z;
        for (auto [u, v] : can) {
            z.push_back((u + i) % v);
        }
        if (can.size() == z.size()) {
            int y2 = Ask(i);
            for (auto [u, v] : can) {
                if (y2 == (u + i) % v) {
                    cout << "! " << u << ' ' << v << endl;
                    return 0;
                }
            }
        }
    }
}
0