結果

問題 No.1429 Simple Dowsing
ユーザー shiomusubi496shiomusubi496
提出日時 2021-03-14 14:06:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 1,683 ms
コンパイル使用メモリ 177,864 KB
実行使用メモリ 24,408 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:00:18
合計ジャッジ時間 3,206 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 25 ms
23,412 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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};
      |                 ^
main.cpp:15:50: 警告: ‘d2’ may be used uninitialized [-Wmaybe-uninitialized]
   15 |             printf("! %d %d\n",mp[d2].first,mp[d2].second);fflush(stdout);
      |                                                  ^
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/map:61,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:81,
         次から読み込み:  main.cpp:1:
/usr/local/gcc7/include/c++/12.2.0/bits/stl_map.h:502:7: 備考: by argument 2 of type ‘const std::map<long long int, std::pair<long long int, long long int> >::key_type&’ {aka ‘const long long int&’} to ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = long long int; _Tp = std::pair<long long int, long long int>; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, std::pair<long long int, long long int> > >]’ declared here
  502 |       operator[](const key_type& __k)
      |       ^~~~~~~~
main.cpp:14:17: 備考: ‘d2’ はここで宣言されています
   14 |             int d2;scanf("%d",&d);
      |                 ^~
main.cpp:15:37: 警告: ‘d2’ may be used uninitialized [-Wmaybe-uninitialized]
   15 |             printf("! %d %d\n",mp[d2].first,mp[d2].second);fflush(stdout);
      |                                     ^
/usr/local/gcc7/include/c++/12.2.0/bits/stl_map.h:502:7: 備考: by argument 2 of type ‘const std::map<long long int, std::pair<long long int, long long int> >::key_type&’ {aka ‘const long long int&’} to ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Allo

ソースコード

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",&d);
            printf("! %d %d\n",mp[d2].first,mp[d2].second);fflush(stdout);
            return 0;
        }
    }
}
0