結果
| 問題 | 
                            No.2357 Guess the Function
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-06-23 21:38:55 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 992 bytes | 
| コンパイル時間 | 2,951 ms | 
| コンパイル使用メモリ | 249,908 KB | 
| 実行使用メモリ | 25,604 KB | 
| 平均クエリ数 | 3.00 | 
| 最終ジャッジ日時 | 2024-07-01 01:14:16 | 
| 合計ジャッジ時間 | 4,295 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 6 WA * 4 | 
ソースコード
#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;
                }
            }
        }
    }
}