結果
問題 | No.1429 Simple Dowsing |
ユーザー | shiomusubi496 |
提出日時 | 2021-03-14 14:06:21 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 633 bytes |
コンパイル時間 | 1,697 ms |
コンパイル使用メモリ | 178,652 KB |
実行使用メモリ | 25,848 KB |
平均クエリ数 | 3.00 |
最終ジャッジ日時 | 2024-07-17 10:46:46 |
合計ジャッジ時間 | 2,998 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 22 ms
24,568 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: In function 'int main()': main.cpp:11:17: warning: 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: warning: 'd2' may be used uninitialized [-Wmaybe-uninitialized] 15 | printf("! %d %d\n",mp[d2].first,mp[d2].second);fflush(stdout); | ^ In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/map:61, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:81, from main.cpp:1: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_map.h:502:7: note: 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: note: 'd2' declared here 14 | int d2;scanf("%d",&d); | ^~ main.cpp:15:37: warning: 'd2' may be used uninitialized [-Wmaybe-uninitialized] 15 | printf("! %d %d\n",mp[d2].first,mp[d2].second);fflush(stdout); | ^ /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_map.h:502:7: note: 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, _Al
ソースコード
#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; } } }