結果

問題 No.2768 Password Crack
ユーザー Kei
提出日時 2024-05-31 23:58:08
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 3,836 ms
コンパイル使用メモリ 273,156 KB
実行使用メモリ 25,604 KB
平均クエリ数 1008.63
最終ジャッジ日時 2024-12-21 01:52:02
合計ジャッジ時間 10,725 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string ans = string(N, 'a');
  for (int i = 0; i < N; i++) {
    int pre = -1;
    bool ok = false;
    for (int j = 0; j < 25; j++) {
      ans[i] = 'a' + j;
      cout << "? " << ans << endl;
      int n;
      cin >> n;
      if (n < pre) {
        ans[i] = 'a' + j - 1;
        ok = true;
        break;
      }
      pre = max(pre, n);
    }    
    if (!ok) ans[i] = 'z';
  }
  cout << "! " << ans << endl;
}
0