結果

問題 No.355 数当てゲーム(2)
ユーザー 👑 kmjpkmjp
提出日時 2016-06-02 21:55:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 1,260 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 149,072 KB
実行使用メモリ 24,480 KB
平均クエリ数 21.48
最終ジャッジ日時 2023-09-24 00:04:20
合計ジャッジ時間 5,540 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,508 KB
testcase_01 AC 21 ms
24,348 KB
testcase_02 AC 20 ms
23,808 KB
testcase_03 AC 22 ms
23,856 KB
testcase_04 AC 21 ms
24,348 KB
testcase_05 AC 21 ms
23,400 KB
testcase_06 AC 22 ms
23,676 KB
testcase_07 AC 21 ms
24,012 KB
testcase_08 AC 21 ms
23,508 KB
testcase_09 AC 21 ms
23,412 KB
testcase_10 AC 20 ms
23,508 KB
testcase_11 AC 22 ms
23,496 KB
testcase_12 AC 20 ms
23,436 KB
testcase_13 AC 23 ms
23,388 KB
testcase_14 AC 23 ms
23,388 KB
testcase_15 AC 23 ms
24,012 KB
testcase_16 AC 22 ms
24,012 KB
testcase_17 AC 20 ms
24,012 KB
testcase_18 AC 22 ms
23,496 KB
testcase_19 AC 20 ms
24,252 KB
testcase_20 AC 22 ms
24,348 KB
testcase_21 AC 21 ms
23,832 KB
testcase_22 AC 21 ms
24,000 KB
testcase_23 AC 22 ms
23,352 KB
testcase_24 AC 21 ms
24,456 KB
testcase_25 AC 22 ms
23,820 KB
testcase_26 AC 20 ms
24,012 KB
testcase_27 AC 20 ms
23,352 KB
testcase_28 AC 20 ms
23,400 KB
testcase_29 AC 21 ms
23,400 KB
testcase_30 AC 22 ms
24,048 KB
testcase_31 AC 22 ms
24,012 KB
testcase_32 AC 22 ms
24,060 KB
testcase_33 AC 24 ms
23,688 KB
testcase_34 AC 23 ms
24,480 KB
testcase_35 AC 22 ms
23,508 KB
testcase_36 AC 21 ms
23,496 KB
testcase_37 AC 23 ms
23,616 KB
testcase_38 AC 22 ms
24,324 KB
testcase_39 AC 22 ms
23,700 KB
testcase_40 AC 23 ms
23,676 KB
testcase_41 AC 22 ms
23,844 KB
testcase_42 AC 21 ms
23,340 KB
testcase_43 AC 21 ms
24,312 KB
testcase_44 AC 20 ms
24,060 KB
testcase_45 AC 22 ms
23,352 KB
testcase_46 AC 20 ms
23,388 KB
testcase_47 AC 20 ms
24,048 KB
testcase_48 AC 21 ms
24,000 KB
testcase_49 AC 20 ms
23,820 KB
testcase_50 AC 21 ms
24,060 KB
testcase_51 AC 21 ms
24,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N[10];

pair<int,int> ask(int a,int b,int c,int d) {
	int x,y;
	cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
	cin>>x>>y;
	return {x,y};
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int mi=4;
	for(i=3;i<=9;i++) {
		auto r=ask(0,1,2,i);
		if(r.first==4) return;
		N[i]=r.first+r.second;
		mi=min(mi,N[i]);
	}
	for(i=3;i<=9;i++) N[i]=N[i]-mi;
	for(i=0;i<=2;i++) {
		auto r=ask(i,7,8,9);
		if(r.first==4) return;
		N[i]=r.first+r.second-N[7]-N[8]-N[9];
	}
	vector<int> V;
	FOR(i,10) if(N[i]) V.push_back(i);
	do {
		auto r=ask(V[0],V[1],V[2],V[3]);
		if(r.first==4) return;
	} while(next_permutation(ALL(V)));
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0