結果

問題 No.1429 Simple Dowsing
ユーザー outlineoutline
提出日時 2021-03-28 20:27:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 1,424 bytes
コンパイル時間 1,143 ms
コンパイル使用メモリ 132,312 KB
実行使用メモリ 24,408 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:17:43
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,448 KB
testcase_01 AC 24 ms
24,336 KB
testcase_02 AC 23 ms
24,024 KB
testcase_03 AC 24 ms
24,012 KB
testcase_04 AC 23 ms
23,832 KB
testcase_05 AC 23 ms
24,024 KB
testcase_06 AC 22 ms
23,232 KB
testcase_07 AC 23 ms
23,412 KB
testcase_08 AC 22 ms
23,664 KB
testcase_09 AC 22 ms
23,832 KB
testcase_10 AC 21 ms
24,024 KB
testcase_11 AC 22 ms
24,312 KB
testcase_12 AC 22 ms
24,408 KB
testcase_13 AC 22 ms
24,348 KB
testcase_14 AC 22 ms
24,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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