結果

問題 No.305 鍵(2)
ユーザー Kmcode1
提出日時 2015-11-27 22:40:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,130 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 104,932 KB
実行使用メモリ 25,220 KB
平均クエリ数 131.23
最終ジャッジ日時 2024-07-16 20:46:41
合計ジャッジ時間 2,264 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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