結果
| 問題 | No.2768 Password Crack |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-01 12:41:10 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 900 bytes |
| 記録 | |
| コンパイル時間 | 1,689 ms |
| コンパイル使用メモリ | 100,772 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 1785.17 |
| 最終ジャッジ日時 | 2024-12-21 19:28:13 |
| 合計ジャッジ時間 | 7,275 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 WA * 24 |
ソースコード
#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 = '\0';
for(const auto j: std::views::iota(0, 25)) {
s[i] = 'a' + j;
std::cout << "? " + s << std::endl;
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";
}