結果

問題 No.305 鍵(2)
ユーザー femtofemto
提出日時 2016-08-12 00:15:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 77,848 KB
実行使用メモリ 25,220 KB
平均クエリ数 87.62
最終ジャッジ日時 2024-07-17 00:18:09
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:37:30: warning: 'maxj' may be used uninitialized [-Wmaybe-uninitialized]
   37 |                 ans[i] = '0' + maxj;
      |                          ~~~~^~~~~~
main.cpp:25:24: note: 'maxj' was declared here
   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[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;
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0