結果

問題 No.2768 Password Crack
ユーザー tobbie
提出日時 2024-07-16 22:48:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 592 bytes
コンパイル時間 1,915 ms
コンパイル使用メモリ 172,012 KB
実行使用メモリ 39,888 KB
平均クエリ数 4.03
最終ジャッジ日時 2024-07-16 22:48:35
合計ジャッジ時間 6,438 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)

int main() {
  int N;
  cin >> N;
  vector<int> a(26, 0);
  vector<char> s;
  rep(i, 26) {
    string T = "";
    rep(j, N)
      T += 'a' + i;
    cout << "? " << T << endl;
    int n;
    cin >> n;
    rep(j, n)
      s.push_back('a' + i);
  }
  do {
    string S = "";
    rep(i, N)
      S += s[i];
    cout << "? " << S << endl;
    int n;
    cin >> n;
    if (n == N) {
      cout << "! " << S << endl;
      break;
    }
  } while (next_permutation(s.begin(), s.end()));
  return 0;
}
0