結果

問題 No.2768 Password Crack
ユーザー Mayimg
提出日時 2024-06-01 12:50:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 3,280 ms
コンパイル使用メモリ 266,424 KB
実行使用メモリ 25,604 KB
平均クエリ数 726.70
最終ジャッジ日時 2024-12-21 19:48:15
合計ジャッジ時間 8,969 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize "O3,omit-frame-pointer,inline"
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

signed main () {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;

  string ans;
  for (int u = 0; u < n; u++) {
    bool found = false;
    for (char c = 'a'; c < 'z'; c++) {
      string t;
      for (int v = 0; v < n; v++) {
        if (v == u) {
          t += c;
        } else {
          t += c + 1;
        }
      }

      cout << "? " << t << endl;
      int res;
      cin >> res;
      if (res == 1) {
        ans += c;
        found = true;
        break;
      }
    }

    if (!found) {
      ans += 'z';
    }
  }

  cout << "! " << ans << endl;

  return 0;  
}


0