結果

問題 No.1429 Simple Dowsing
ユーザー MtSakaMtSaka
提出日時 2021-03-14 14:35:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 5,030 bytes
コンパイル時間 2,949 ms
コンパイル使用メモリ 198,520 KB
実行使用メモリ 24,180 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:04:23
合計ジャッジ時間 4,449 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,316 KB
testcase_01 AC 23 ms
24,180 KB
testcase_02 AC 26 ms
23,400 KB
testcase_03 AC 24 ms
23,628 KB
testcase_04 AC 23 ms
23,808 KB
testcase_05 AC 23 ms
23,832 KB
testcase_06 AC 24 ms
24,024 KB
testcase_07 AC 24 ms
23,388 KB
testcase_08 AC 24 ms
24,168 KB
testcase_09 AC 23 ms
23,652 KB
testcase_10 AC 24 ms
23,172 KB
testcase_11 AC 24 ms
23,520 KB
testcase_12 AC 22 ms
23,340 KB
testcase_13 AC 25 ms
23,664 KB
testcase_14 AC 23 ms
23,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//GIVE ME AC!!!!!!!!!!!!!!!!!
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<complex>
//#include<atcoder/all>
#define ll long long
#define MOD 1000000007
#define mod 998244353
#define floatset(n) fixed<<setprecision(n)
#define all(n) n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
#define rep(i, s, n) for (ll i=s;i<(ll)(n);i++)
//#define mint modint1000000007
using namespace std;
//using namespace atcoder;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double PI=acos(-1);
//素数判定 O(√N)
ll prime(ll num){
    if (num < 2){
        return 0;
    }
    else if (num == 2){
        return 1;
    }
    else if (num % 2 == 0){
        return 0;
    }
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0){
            return 0;
        }
    }
    return 1;
}
//素因数分解(約数列挙) O(√N)
vector<ll> divisor(ll n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}
//最大公約数
ll gcd(ll x,ll y){
    if(x<y) swap(x,y);
    //xの方が常に大きい
    ll r;
    while(y>0){
        r=x%y;
        x=y;
        y=r;
    }
    return x;
}
//最小公倍数
ll lcm(ll x,ll y){
    return (ll)(x/gcd(x,y))*y;
}
//転倒数
ll merge_cnt(vector<ll> &a) {
    ll n = a.size();
    if (n <= 1) { return 0; }
    ll cnt = 0;
    vector<ll> b(a.begin(), a.begin()+n/2);
    vector<ll> c(a.begin()+(n/2), a.end());
    cnt += merge_cnt(b);
    cnt += merge_cnt(c);
    ll ai = 0, bi = 0, ci = 0;
    // merge の処理
    while (ai < n) {
        if ( bi < b.size() && (ci == c.size() || b[bi] <= c[ci]) ) {
            a[ai++] = b[bi++];
        } 
      else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}
ll modinv(ll a){
  ll b=MOD,x=1,y=0;
  while(b>0){
    x-=y*(a/b);
    swap(x,y);
    a=a%b;
    swap(a,b);
  }
  x=x%MOD; 
  if(x>=0){
    return x;
  }
  else{
    return x+MOD;
  }
}
 
ll COM(ll n,ll k){
  ll res=1;
  for(ll i=1;i<=k;i++){
    res=res*(n-i+1)%MOD*modinv(i)%MOD;
  }
  return res;
}
 
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }
    int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
    }
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
const ll inf = 1e18;
typedef pair<long long, long long > P;
struct Edge {
    long long to;
    long long cost;
};
using Graph = vector<vector<Edge>>;
using graph=vector<vector<ll>>;
void dijkstra(const Graph& G, ll s, vector<long long>& dis) {
    ll N = G.size();
    dis.resize(N, inf);
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.emplace(dis[s], s);
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        ll v = p.second;
        if (dis[v] < p.first) {
            continue;
        }
        if (v == s) {
            for (auto& e : G[v]) {
                if (dis[e.to] > e.cost) {
                    dis[e.to] = e.cost;
                    pq.emplace(dis[e.to], e.to);
                }
            }
        }
        else {
            for (auto& e : G[v]) {
                if (dis[e.to] > dis[v] + e.cost) {
                    dis[e.to] = dis[v] + e.cost;
                    pq.emplace(dis[e.to], e.to);
                }
            }
        }
    }
}
ll dist(ll a,ll b,ll c,ll d){
    return (a-c)*(a-c)+(b-d)*(b-d);
}
int main(){
    cout<<"? 0 100"<<endl;
    ll a,b;
    cin>>a;
    cout<<"? 0 0"<<endl;
    cin>>b;
   rep(i,0,101){
       rep(j,0,101){
           if(dist(0,100,i,j)==a&&dist(0,0,i,j)==b){
               cout<<"! "<<i<<" "<<j<<endl;
               return 0;
           }
       }
   }
}
0