結果

問題 No.1429 Simple Dowsing
ユーザー rym903rym903
提出日時 2021-03-20 18:27:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 2,233 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 108,412 KB
実行使用メモリ 24,396 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:15:30
合計ジャッジ時間 2,342 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,520 KB
testcase_01 AC 25 ms
24,348 KB
testcase_02 AC 24 ms
23,388 KB
testcase_03 AC 25 ms
23,988 KB
testcase_04 AC 25 ms
24,024 KB
testcase_05 AC 25 ms
23,784 KB
testcase_06 AC 24 ms
24,396 KB
testcase_07 AC 24 ms
23,388 KB
testcase_08 AC 25 ms
23,532 KB
testcase_09 AC 25 ms
23,640 KB
testcase_10 AC 24 ms
24,012 KB
testcase_11 AC 24 ms
24,336 KB
testcase_12 AC 25 ms
23,832 KB
testcase_13 AC 25 ms
24,012 KB
testcase_14 AC 26 ms
24,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<chrono>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
// #define MOD (998244353)
#define INF (1e9+7)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
using P=pair<ll,ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pl(T x){cout << x << " ";}
template<class T>void pr(T x){cout << x << endl;}
template <class T, class... Ts> inline void pr(T Tar, Ts... ts) { std::cout << Tar << " "; pr(ts...); return; }
template<class T>void prvec(vector<T>& a){rep(i, (int)a.size()-1){pl(a[i]);} pr(a.back());}
template<class T>void prarr(arr<T>& a){rep(i, (int)a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}

int main()
{
    printf("? 0 0\n");
    int d; cin >> d;

    vint x, y;
    rep(i, 101) rep(j, 101){
        if(i*i + j*j == d){
            x.push_back(i);
            y.push_back(j);
        }
    }
    printf("? %d %d\n", x[0], y[0]);
    cin >> d;

    rep(i, x.size()) rep(j, y.size()){
        int dx = x[0] - x[i];
        int dy = y[0] - y[j];
        if(dx*dx + dy*dy == d){
            printf("! %d %d\n", x[i], y[j]);
            return 0;
        }
    }
    return 0;}
0