結果
問題 |
No.2768 Password Crack
|
ユーザー |
|
提出日時 | 2024-06-01 12:36:15 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 887 bytes |
コンパイル時間 | 2,720 ms |
コンパイル使用メモリ | 100,992 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 1785.17 |
最終ジャッジ日時 | 2024-12-21 19:19:29 |
合計ジャッジ時間 | 8,263 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:26:14: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized] 26 | s[i] = c; main.cpp:12:14: note: 'c' was declared here 12 | char c; | ^
ソースコード
#include <iostream> #include <ranges> constexpr int INF = 1 << 30; template <class T> constexpr inline bool chmin(T& a, const T& b) noexcept { if(a > b){ a = b; return true; } return false; } template <class T> constexpr inline bool chmax(T& a, const T& b) noexcept { if(a < b){ a = b; return true; } return false; } int main() { int n, cnt = 0; std::cin >> n; std::string s(n, 'a'); for(const auto i: std::views::iota(0, n)) { int chk = INF; char c; for(const auto j: std::views::iota(0, 25)) { s[i] = 'a' + j; std::cout << "? " + s + "\n"; int now; std::cin >> now; if(chmax(cnt, now)) { c = 'a' + j; } chmin(chk, now); } if(chk == cnt) { c = 'z'; } s[i] = c; } std::cout << "! " + s + "\n"; }