結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
![]() |
提出日時 | 2016-04-03 23:32:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,317 bytes |
コンパイル時間 | 914 ms |
コンパイル使用メモリ | 87,972 KB |
実行使用メモリ | 25,964 KB |
平均クエリ数 | 62.00 |
最終ジャッジ日時 | 2024-07-16 09:41:26 |
合計ジャッジ時間 | 11,842 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 52 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <sstream> #include <map> #include <set> #include <queue> #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; using ll = long long; #define all(c) (c).begin(), (c).end() #define rep(i,n) for(int i=0;i<(int)(n);i++) #define pb(e) push_back(e) #define mp(a, b) make_pair(a, b) #define fr first #define sc second const ll INF=1e9; const ll MOD=1e9+7; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; vector<int> ans; pair<int,int> query(vector<int> vec) { rep(i,4) cout<<vec[i]<<(i==3?"\n":" "); cout<<flush; pair<int,int> ret; cin>>ret.first>>ret.second; return ret; } int sum(pair<int,int> p) { return p.first+p.second; } int main() { ans.resize(4); rep(i,4) ans[i]=i; vector<int> vec=ans; vec.resize(4); set<int> s; rep(i,4) { auto p=query(ans); rep(j,10) if(!s.count(j)) { vec[i]=j; auto t=query(vec); if(sum(t)>=sum(p)) { p=t; ans=vec; } } s.insert(ans[i]); vec=ans; } sort(all(ans)); do { auto p=query(ans); if(p.first==4) break; }while(std::next_permutation(all(ans))); return 0; }