結果

問題 No.2768 Password Crack
ユーザー kenken714
提出日時 2025-03-07 14:53:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 903 bytes
コンパイル時間 2,543 ms
コンパイル使用メモリ 203,176 KB
実行使用メモリ 26,356 KB
平均クエリ数 1785.17
最終ジャッジ日時 2025-03-07 14:53:22
合計ジャッジ時間 7,918 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1ll << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

int main(){
  ll n;
  cin >> n;
  string ans;
  REP(i, n){
    vector<P> v;
    REP(j, 25){
      string q;
      REP(k, i)q.push_back('a');
      q.push_back('a' + j);
      REP(k, n - i - 1)q.push_back('a');
      cout <<"? " << q << endl;
      ll res;
      cin >> res;
      v.push_back(P(res, j));
    }
    sort(ALL(v));
    if(v[0].first == v[24].first)ans.push_back('z');
    else ans.push_back('a' + v[24].second);
  }
  cout << "! " << ans << endl;
}
0