結果

問題 No.305 鍵(2)
ユーザー Kmcode1Kmcode1
提出日時 2015-11-27 22:40:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 1,130 bytes
コンパイル時間 854 ms
コンパイル使用メモリ 104,168 KB
実行使用メモリ 24,348 KB
平均クエリ数 131.23
最終ジャッジ日時 2023-09-23 20:56:00
合計ジャッジ時間 2,365 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
24,288 KB
testcase_01 AC 29 ms
23,880 KB
testcase_02 AC 28 ms
23,664 KB
testcase_03 AC 28 ms
23,652 KB
testcase_04 AC 29 ms
23,580 KB
testcase_05 AC 31 ms
24,288 KB
testcase_06 AC 24 ms
23,460 KB
testcase_07 AC 30 ms
24,288 KB
testcase_08 AC 29 ms
23,460 KB
testcase_09 AC 29 ms
23,676 KB
testcase_10 AC 30 ms
24,348 KB
testcase_11 AC 29 ms
24,276 KB
testcase_12 AC 31 ms
24,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
#include<unordered_set>
using namespace std;
string ans = "0000000000";
int main() {
	string t;
	for (int i = 0;i < 10;i++) {
		map<int, int> mp;
		for (int j = 0;j < 10;j++) {
			ans[i] = '0' + j;
			cout << ans << endl;
			int a;
			string b;
			cin >> a >> b;
			if (b == "unlocked") {
				return 0;
			}
			mp[a]++;
		}
		int anss = mp.begin()->first;
		auto it = mp.begin();
		it++;
		if (mp.begin()->second > (it)->second) {
			anss = (it)->first;
		}
		for (int j = 0;j < 10;j++) {
			ans[i] = '0' + j;
			cout << ans << endl;
			int a;
			string b;
			cin >> a >> b;
			if (b == "unlocked") {
				return 0;
			}
			if (a == anss) {
				break;
			}
		}
	}
	return 0;
}
0