結果

問題 No.305 鍵(2)
ユーザー femtofemto
提出日時 2016-08-12 00:13:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 774 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 77,368 KB
実行使用メモリ 24,432 KB
平均クエリ数 93.31
最終ジャッジ日時 2023-09-23 11:18:25
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 26 ms
23,964 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:37:30: 警告: ‘maxj’ may be used uninitialized [-Wmaybe-uninitialized]
   37 |                 ans[i] = '0' + maxj;
      |                          ~~~~^~~~~~
main.cpp:25:24: 備考: ‘maxj’ はここで定義されています
   25 |                 int n, maxj, maxn = -1;
      |                        ^~~~

ソースコード

diff #

#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[j] = '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