結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
![]() |
提出日時 | 2019-04-01 20:08:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,093 bytes |
コンパイル時間 | 2,306 ms |
コンパイル使用メモリ | 201,192 KB |
最終ジャッジ日時 | 2025-01-07 00:42:45 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include<bits/stdc++.h>using namespace std;using Int = long long;template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}template<typename T>vector<T> compress(vector<T> v){sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());return v;}//INSERT ABOVE HEREint ask(int a,int b,int c,int d){cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;int x,y;cin>>x>>y;if(x==4) exit(0);return x+y;}signed main(){vector<int> cs;{vector<int> vs(10,0);int tmp=0;for(int i=3;i<10;i++){vs[i]=ask(0,1,2,i);chmax(tmp,vs[i]);}for(int i=3;i<10;i++){if(vs[i]==tmp) cs.emplace_back(i);}}{vector<int> vs(10,0);int tmp=0;for(int i=0;i<7;i++){vs[i]=ask(i,7,8,9);chmax(tmp,vs[i]);}for(int i=0;i<7;i++){if(vs[i]==tmp) cs.emplace_back(i);}}cs=compress(cs);do{ask(cs[0],cs[1],cs[2],cs[3]);}while(next_permutation(cs.begin(),cs.end()));return 0;}