結果
| 問題 | No.2768 Password Crack |
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-05-31 23:00:24 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 2,000 ms |
| コード長 | 842 bytes |
| 記録 | |
| コンパイル時間 | 1,164 ms |
| コンパイル使用メモリ | 212,744 KB |
| 実行使用メモリ | 30,020 KB |
| 平均クエリ数 | 1785.17 |
| 最終ジャッジ日時 | 2026-07-04 20:06:07 |
| 合計ジャッジ時間 | 4,274 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
fast_io();
int n;
cin >> n;
string ans(n, 'a');
for (int i = 0; i < n; i++) {
vector<int> cnt(25);
for (int j = 0; j < 25; j++) {
ans[i] = 'a' + j;
cout << "? " << ans << endl;
cin >> cnt[j];
}
bool all_same = true;
int ma_idx = 0;
for (int j = 1; j < 25; j++) {
if (cnt[j] != cnt[ma_idx]) {
all_same = false;
}
if (cnt[j] > cnt[ma_idx]) {
ma_idx = j;
}
}
if (all_same) {
ans[i] = 'z';
} else {
ans[i] = 'a' + ma_idx;
}
}
cout << "! " << ans << endl;
}
eve__fuyuki