結果
| 問題 | No.355 数当てゲーム(2) |
| コンテスト | |
| ユーザー |
LayCurse
|
| 提出日時 | 2016-04-01 22:27:37 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 1,034 bytes |
| 記録 | |
| コンパイル時間 | 964 ms |
| コンパイル使用メモリ | 176,196 KB |
| 実行使用メモリ | 28,988 KB |
| 平均クエリ数 | 5.31 |
| 最終ジャッジ日時 | 2026-03-31 12:58:06 |
| 合計ジャッジ時間 | 4,102 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
char memarr[17000000]; void *mem = memarr;
#define MD 1000000007
int ok[10][10][10][10];
int main(){
int i, j, k, l, x, y, s, t;
int a, b, c, d;
int use[10];
rep(a,10) rep(b,10) rep(c,10) rep(d,10){
if(a!=b && a!=c && a!=d && b!=c && b!=d && c!=d) ok[a][b][c][d] = 1;
}
for(;;){
for(;;){
a=rand()%10;
b=rand()%10;
c=rand()%10;
d=rand()%10;
if(ok[a][b][c][d]) break;
}
printf("%d %d %d %d\n",a,b,c,d);
fflush(stdout);
scanf("%d%d",&x,&y);
if(x==4) break;
rep(i,10) use[i] = 0;
use[a] = use[b] = use[c] = use[d] = 1;
rep(i,10) rep(j,10) rep(k,10) rep(l,10) if(ok[i][j][k][l]){
s = 0;
if(i==a) s++;
if(j==b) s++;
if(k==c) s++;
if(l==d) s++;
t = use[i] + use[j] + use[k] + use[l] - s;
if(s!=x || t!=y) ok[i][j][k][l] = 0;
}
}
return 0;
}
LayCurse