結果

問題 No.2768 Password Crack
ユーザー MayimgMayimg
提出日時 2024-06-01 12:50:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 3,745 ms
コンパイル使用メモリ 267,560 KB
実行使用メモリ 25,604 KB
平均クエリ数 726.70
最終ジャッジ日時 2024-06-01 12:50:15
合計ジャッジ時間 9,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 23 ms
24,964 KB
testcase_02 AC 95 ms
24,580 KB
testcase_03 AC 26 ms
25,220 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 64 ms
24,964 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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