結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
femto
|
| 提出日時 | 2016-08-12 00:12:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 742 bytes |
| コンパイル時間 | 758 ms |
| コンパイル使用メモリ | 78,228 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 93.31 |
| 最終ジャッジ日時 | 2024-07-16 10:51:16 |
| 合計ジャッジ時間 | 4,138 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 12 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:35:30: warning: 'maxj' may be used uninitialized [-Wmaybe-uninitialized]
35 | ans[i] = '0' + maxj;
| ~~~~^~~~~~
main.cpp:24:24: note: 'maxj' was declared here
24 | int n, maxj, maxn = -1;
| ^~~~
ソースコード
#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;
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;
cin >> n >> res;
if(res == "unlocked") return 0;
if(maxn == -1 || maxn < n) {
maxj = j;
maxn = n;
}
}
ans[i] = '0' + maxj;
}
}
femto