結果

問題 No.355 数当てゲーム(2)
ユーザー LayCurseLayCurse
提出日時 2016-04-01 22:27:37
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 1,034 bytes
コンパイル時間 1,195 ms
コンパイル使用メモリ 144,820 KB
実行使用メモリ 24,420 KB
平均クエリ数 5.31
最終ジャッジ日時 2023-09-23 23:22:21
合計ジャッジ時間 5,498 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
23,652 KB
testcase_01 AC 20 ms
24,024 KB
testcase_02 AC 19 ms
23,676 KB
testcase_03 AC 19 ms
24,036 KB
testcase_04 AC 20 ms
24,192 KB
testcase_05 AC 20 ms
24,324 KB
testcase_06 AC 20 ms
23,376 KB
testcase_07 AC 20 ms
24,408 KB
testcase_08 AC 22 ms
24,360 KB
testcase_09 AC 20 ms
23,652 KB
testcase_10 AC 20 ms
24,036 KB
testcase_11 AC 20 ms
23,628 KB
testcase_12 AC 20 ms
24,072 KB
testcase_13 AC 21 ms
23,832 KB
testcase_14 AC 21 ms
23,832 KB
testcase_15 AC 20 ms
23,640 KB
testcase_16 AC 20 ms
23,388 KB
testcase_17 AC 20 ms
24,036 KB
testcase_18 AC 21 ms
24,384 KB
testcase_19 AC 20 ms
24,360 KB
testcase_20 AC 21 ms
23,976 KB
testcase_21 AC 20 ms
23,544 KB
testcase_22 AC 23 ms
23,676 KB
testcase_23 AC 19 ms
24,048 KB
testcase_24 AC 21 ms
23,832 KB
testcase_25 AC 20 ms
23,364 KB
testcase_26 AC 20 ms
23,664 KB
testcase_27 AC 19 ms
24,396 KB
testcase_28 AC 20 ms
24,396 KB
testcase_29 AC 19 ms
23,364 KB
testcase_30 AC 19 ms
24,024 KB
testcase_31 AC 20 ms
23,520 KB
testcase_32 AC 21 ms
24,036 KB
testcase_33 AC 21 ms
23,388 KB
testcase_34 AC 20 ms
24,384 KB
testcase_35 AC 21 ms
24,276 KB
testcase_36 AC 20 ms
23,544 KB
testcase_37 AC 19 ms
23,988 KB
testcase_38 AC 20 ms
23,820 KB
testcase_39 AC 19 ms
23,664 KB
testcase_40 AC 20 ms
23,544 KB
testcase_41 AC 20 ms
24,036 KB
testcase_42 AC 21 ms
24,288 KB
testcase_43 AC 20 ms
23,364 KB
testcase_44 AC 20 ms
24,420 KB
testcase_45 AC 21 ms
23,664 KB
testcase_46 AC 19 ms
24,264 KB
testcase_47 AC 20 ms
23,820 KB
testcase_48 AC 21 ms
24,036 KB
testcase_49 AC 21 ms
24,060 KB
testcase_50 AC 21 ms
24,036 KB
testcase_51 AC 20 ms
23,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0