結果

問題 No.305 鍵(2)
コンテスト
ユーザー femto
提出日時 2016-08-12 00:15:42
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 774 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 507 ms
コンパイル使用メモリ 92,864 KB
実行使用メモリ 28,976 KB
平均クエリ数 87.62
最終ジャッジ日時 2026-03-31 14:47:02
合計ジャッジ時間 1,558 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
template<typename T> void setmin(T& a, T b) { a = min(a, b); }
template<typename T> void setmax(T& a, T b) { a = max(a, b); }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string ans = "0000000000", res;
	int pn;

	cout << ans << endl;
	cout.flush();
	cin >> pn >> res;
	if(res == "unlocked") return 0;

	for(int i = 0; i < 10; i++) {
		int n, maxj, maxn = -1;
		for(int j = 0; j < 10; j++) {
			ans[i] = '0' + j;
			cout << ans << endl;
			cout.flush();
			cin >> n >> res;
			if(res == "unlocked") return 0;
			if(maxn == -1 || maxn < n) {
				maxj = j;
				maxn = n;
			}
		}
		ans[i] = '0' + maxj;
	}
}
0