結果
問題 |
No.2768 Password Crack
|
ユーザー |
![]() |
提出日時 | 2024-06-28 00:37:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 771 bytes |
コンパイル時間 | 3,300 ms |
コンパイル使用メモリ | 244,396 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 822.83 |
最終ジャッジ日時 | 2024-06-28 00:37:29 |
合計ジャッジ時間 | 9,554 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline int Query(const string& s) { cout << "? " << s << endl; int res; cin >> res; return res; } int main() { int n; cin >> n; string s(n, 'a'); int base = Query(s); rep(i, n) { rep(j, 24) { s[i] = 'b' + j; int res = Query(s); if (res > base) { s[i] = 'b' + j; base = res; break; } else if (res < base) { s[i] = 'a'; break; } if (j == 23) s[i] = 'z'; } } cout << "! " << s << endl; return 0; }