結果

問題 No.355 数当てゲーム(2)
ユーザー kzyKTkzyKT
提出日時 2016-04-01 22:48:26
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,857 bytes
コンパイル時間 1,066 ms
コンパイル使用メモリ 146,916 KB
実行使用メモリ 35,292 KB
平均クエリ数 0.02
最終ジャッジ日時 2023-09-23 23:23:09
合計ジャッジ時間 4,784 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define mem(a) memset(a,0,sizeof(a))
#define pd(a) printf("%.10f\n",a)
#define pb(a) push_back(a)
#define in(a) insert(a)
#define pi M_PI
#define R cin>>
#define F first
#define S second
#define C class
#define ll long long
#define ln cout<<'\n'
#define _(_1,_2,_3,N,...)N
#define pr(...) _(__VA_ARGS__,pr3,pr2,pr1)(__VA_ARGS__)
template<C T>void pr1(T a){cout<<a;ln;}
template<C T,C T2>void pr2(T a,T2 b){cout<<a<<' '<<b;ln;}
template<C T,C T2,C T3>void pr3(T a,T2 b,T3 c){cout<<a<<' '<<b<<' '<<c;ln;}
template<C T>void PR(T a,int n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int a[4]={1,2,3,4};
  int xx=-1,yy=-1;
  bool u[10];
  mem(u);
  REP(i,1,5) u[i]=1;
  rrep(i,4) {
    int k=i,z=a[i];
    while(k<10&&u[k])k++;
    while(1) {
      PR(a,4);
      cout.flush();
      int x,y;
      cin >> x >> y;
      if(x==4) return;
      if(x+y==4) goto end;
      if(xx!=-1) {
        if(x+y<xx+yy) {
          a[i]=z;
          break;
        } else if(x+y>xx+yy) {
          xx=x;
          yy=y;
          break;
        }
        while(k<10&&u[k])k++;
      }
      u[k]=1;
      z=a[i];
      a[i]=k;
      xx=x;
      yy=y;
    }
  }
 end:;
  sort(a,a+4);
  do {
    PR(a,4);
    cout.flush();
    int x,y;
    cin >> x >> y;
    if(x==4) break;
  } while(next_permutation(a,a+4));
}

int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  Main();return 0;
}
0