結果

問題 No.1429 Simple Dowsing
コンテスト
ユーザー outline
提出日時 2021-03-28 20:27:53
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 1,424 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 769 ms
コンパイル使用メモリ 153,336 KB
実行使用メモリ 29,764 KB
平均クエリ数 3.00
最終ジャッジ日時 2026-06-19 01:49:32
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
using namespace std;

using ll = long long;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int d, d2;
    cout << "? " << 0 << " " << 0 << endl;
    cin >> d;
    cout << "? " << 100 << " " << 0 << endl;
    cin >> d2;
    for(int x = 0; x <= 100; ++x){
        for(int y = 0; y <= 100; ++y){
            int D = x * x + y * y;
            int D2 = (x - 100) * (x - 100) + y * y;
            if(D == d && D2 == d2){
                cout << "! " << x << " " << y << endl;
                return 0;
            }
        }
    }

    return 0;
}
0