結果

問題 No.305 鍵(2)
ユーザー takubokudoritakubokudori
提出日時 2017-09-07 14:29:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,542 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 89,900 KB
実行使用メモリ 24,264 KB
平均クエリ数 47.77
最終ジャッジ日時 2023-09-24 01:32:32
合計ジャッジ時間 2,204 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,376 KB
testcase_01 AC 25 ms
24,264 KB
testcase_02 AC 23 ms
23,640 KB
testcase_03 AC 25 ms
24,024 KB
testcase_04 AC 27 ms
23,376 KB
testcase_05 AC 27 ms
23,640 KB
testcase_06 AC 24 ms
23,352 KB
testcase_07 AC 30 ms
23,820 KB
testcase_08 AC 28 ms
23,532 KB
testcase_09 AC 28 ms
23,520 KB
testcase_10 AC 27 ms
23,628 KB
testcase_11 AC 28 ms
24,036 KB
testcase_12 AC 28 ms
24,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#define N 1000
// #define MOD 1000000007
#define MOD 1000000000000
#define pe(str) return cout<<(str)<<endl,0
#define px(str) {cout<<(str)<<endl;exit(0);}
#define re(i,n) for(int i=0;i<(n);i++)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define fe(i,n,f) for_each(i,n,f)
#define bw(a,b,c) (((a)<=(b))&&((b)<=(c)))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;

template<class InputIterator>
void dump(InputIterator first,InputIterator last,char delim=' '){
	for(InputIterator it=first;it!=last;it++){
		if(it!=first)cout<<delim;
		cout<<*it;
	}
}

string a="1234567890";
int q(string s){
	string k;
	int z=0;
	cout<<s<<endl;
	// re(i,10) if(s[i]==a[i]) z++;
	cin>>z>>k;
	if(z==10)exit(0);
	return z;
}
int main(void){
	string s="0000000000";
	string ans="xxxxxxxxxx";
	int k=q(s);
	if(k!=0){
		re(i,10){
			s[i]=1+'0';
			int t=q(s);
			if(t<k){
				ans[i]=0+'0';
			}
			s[i]=0+'0';
		}
	}
	re(i,10){
		if(ans[i]!='x')continue;
		rep(j,1,10){
			s[i]=j+'0';
			int t=q(s);
			cerr<<"dbg:"<<t<<k<<endl;
			if(t>k){
				ans[i]=j+'0';
				s[i]=0+'0';
				break;
			}
			s[i]=0+'0';
		}
	}
	q(ans);


	return 0;
}
0