結果

問題 No.355 数当てゲーム(2)
ユーザー rickythetarickytheta
提出日時 2016-04-01 22:38:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,272 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 152,712 KB
実行使用メモリ 24,468 KB
平均クエリ数 23.21
最終ジャッジ日時 2023-09-23 09:09:28
合計ジャッジ時間 16,939 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 29 ms
24,324 KB
testcase_36 WA -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 WA -
testcase_41 RE -
testcase_42 WA -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 WA -
testcase_47 RE -
testcase_48 RE -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

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の中に何個あるか
  DEBUG(other);
  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