結果
| 問題 | No.594 壊れた宝物発見機 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-08-01 23:30:30 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 128 ms / 2,000 ms | 
| コード長 | 1,316 bytes | 
| コンパイル時間 | 756 ms | 
| コンパイル使用メモリ | 76,164 KB | 
| 最終ジャッジ日時 | 2025-01-12 12:57:40 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using lint = long long;
constexpr lint INF = 1LL << 60;
lint query(const std::vector<int>& xs) {
    std::cout << "?";
    for (auto x : xs) std::cout << " " << x;
    std::cout << std::endl;
    lint d;
    std::cin >> d;
    return d;
}
void answer(const std::vector<int>& xs) {
    std::cout << "!";
    for (auto x : xs) std::cout << " " << x;
    std::cout << std::endl;
}
void solve() {
    std::vector<int> xs(3, 0);
    for (int i = 0; i < 3; ++i) {
        int lx = -100, rx = 100;
        auto ys = xs;
        while (rx - lx >= 3) {
            int llx = (lx * 2 + rx) / 3,
                rrx = (lx + rx * 2) / 3;
            ys[i] = llx;
            auto dl = query(ys);
            ys[i] = rrx;
            auto dr = query(ys);
            if (dl < dr) {
                rx = rrx;
            } else {
                lx = llx;
            }
        }
        auto dmax = INF;
        for (int x = lx; x <= rx; ++x) {
            ys[i] = x;
            auto d = query(ys);
            if (d < dmax) {
                xs[i] = x;
                dmax = d;
            }
        }
    }
    answer(xs);
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
    return 0;
}
            
            
            
        