結果
| 問題 |
No.355 数当てゲーム(2)
|
| コンテスト | |
| ユーザー |
latte0119
|
| 提出日時 | 2016-04-01 23:48:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 1,236 bytes |
| コンパイル時間 | 1,455 ms |
| コンパイル使用メモリ | 162,152 KB |
| 実行使用メモリ | 25,580 KB |
| 平均クエリ数 | 81.52 |
| 最終ジャッジ日時 | 2024-07-16 23:21:52 |
| 合計ジャッジ時間 | 5,133 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
コンパイルメッセージ
main.cpp: In function ‘pint q(long long int, long long int, long long int, long long int)’:
main.cpp:23:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%lld%lld",&x,&y);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
pint q(int a,int b,int c,int d){
printf("%lld %lld %lld %lld\n",a,b,c,d);
fflush(stdout);
int x,y;
scanf("%lld%lld",&x,&y);
return pint(x,y);
}
signed main(){
vint lis;
rep(i,10){
int b=(i-1+10)%10,c=(i-2+10)%10,d=(i-3+10)%10;
int ma=-1,v=-1;
rep(j,7){
int a=(i+j)%10;
auto p=q(a,b,c,d);
if(p.fi==4)return 0;
if(ma<p.fi+p.se){
ma=p.fi+p.se;
v=a;
}
}
if(i==v)lis.pb(i);
}
do{
auto p=q(lis[0],lis[1],lis[2],lis[3]);
if(p.fi==4)return 0;
}while(next_permutation(all(lis)));
return 0;
}
latte0119