結果

問題 No.355 数当てゲーム(2)
ユーザー rickythetarickytheta
提出日時 2016-04-01 22:40:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 2,256 bytes
コンパイル時間 2,025 ms
コンパイル使用メモリ 152,112 KB
実行使用メモリ 24,408 KB
平均クエリ数 19.62
最終ジャッジ日時 2023-09-23 23:23:04
合計ジャッジ時間 5,740 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int id[11];
  int mn = 100, mx = 0;
  int sum = 0;
  FOR(i,3,10){
    cout<<"0 1 2 "<<i<<endl;
    int x,y;
    cin>>x>>y;
    if(x==4&&y==0)return 0;
    id[i] = x+y;
    mn = min(mn,x+y);
    mx = max(mx,x+y);
    sum += x+y;
  }
  int other = sum - mn*7;  // 3~9の中に何個あるか
  vi cand;
  if(other==1){
    int yey = 0;
    FOR(i,3,10){
      if(id[i]==mn+1){
        yey = i;
        break;
      }
    }
    cand.push_back(0);
    cand.push_back(1);
    cand.push_back(2);
    cand.push_back(yey);
  }else if(other==2){
    int a=0,b=0;
    FOR(i,3,10){
      if(id[i]==mn+1){
        if(!a)a=i;
        else b=i;
      }
    }
    vi t(3);
    REP(i,3)t[i]=i;
    do{
      printf("%d %d %d %d",a,b,t[0],t[1]);
      cout<<endl;
      int x,y;
      cin>>x>>y;
      if(x==4&&y==0)return 0;
      if(x+y==4)break;
    }while(next_permutation(ALL(t)));
    cand.push_back(t[0]);
    cand.push_back(t[1]);
    cand.push_back(a);
    cand.push_back(b);
  }else if(other==3){
    int a=0,b=0,c=0;
    FOR(i,3,10){
      if(id[i]==mn+1){
        if(!a)a=i;
        else if(!b)b=i;
        else c=i;
      }
    }
    REP(i,3){
      printf("%d %d %d %d",a,b,c,i);
      cout<<endl;
      int x,y;
      cin>>x>>y;
      if(x==4&&y==0)return 0;
      if(x+y==4){
        cand.push_back(a);
        cand.push_back(b);
        cand.push_back(c);
        cand.push_back(i);
        break;
      }
    }
  }else if(other==4){
    FOR(i,3,10){
      if(id[i]==mn+1)cand.push_back(i);
    }
  }
  sort(ALL(cand));
  do{
    printf("%d %d %d %d",cand[0],cand[1],cand[2],cand[3]);
    cout<<endl;
    int x,y;
    cin>>x>>y;
    if(x==4&&y==0)return 0;
  }while(next_permutation(ALL(cand)));
  return 0;
}
0