結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
femto
|
| 提出日時 | 2016-08-12 00:19:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 690 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 77,864 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 102.00 |
| 最終ジャッジ日時 | 2024-07-16 10:51:30 |
| 合計ジャッジ時間 | 3,990 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 13 |
コンパイルメッセージ
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:23:24: note: 'maxj' was declared here
23 | int n, maxj, maxn = -1;
| ^~~~
ソースコード
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
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;
}
cout << ans << endl;
cout.flush();
}
femto