結果

問題 No.1429 Simple Dowsing
ユーザー shiomusubi496shiomusubi496
提出日時 2021-03-14 14:07:44
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 1,697 ms
コンパイル使用メモリ 176,600 KB
実行使用メモリ 24,384 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:00:48
合計ジャッジ時間 3,255 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,400 KB
testcase_01 AC 23 ms
23,652 KB
testcase_02 AC 23 ms
24,240 KB
testcase_03 AC 24 ms
23,388 KB
testcase_04 AC 23 ms
24,384 KB
testcase_05 AC 22 ms
23,844 KB
testcase_06 AC 22 ms
23,400 KB
testcase_07 AC 23 ms
23,556 KB
testcase_08 AC 23 ms
23,376 KB
testcase_09 AC 24 ms
23,544 KB
testcase_10 AC 22 ms
23,544 KB
testcase_11 AC 23 ms
24,060 KB
testcase_12 AC 22 ms
23,856 KB
testcase_13 AC 21 ms
23,916 KB
testcase_14 AC 23 ms
23,796 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:11:17: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   11 |         for(auto[a,b]:v)mp[(a-i)*(a-i)+(b-j)*(b-j)]={a,b};
      |                 ^

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    puts("? 0 0");fflush(stdout);
    int d;scanf("%d",&d);
    vector<pair<int,int>>v;
    for(int i=0;i<=100;i++)for(int j=0;j<=100;j++)if(i*i+j*j==d)v.push_back({i,j});
    for(int i=0;i<=100;i++)for(int j=0;j<=100;j++){
        map<int,pair<int,int>>mp;
        for(auto[a,b]:v)mp[(a-i)*(a-i)+(b-j)*(b-j)]={a,b};
        if(mp.size()==v.size()){
            printf("? %d %d\n",i,j);fflush(stdout);
            int d2;scanf("%d",&d2);
            printf("! %d %d\n",mp[d2].first,mp[d2].second);fflush(stdout);
            return 0;
        }
    }
}
0