結果
| 問題 | 
                            No.2768 Password Crack
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-05-31 22:11:25 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 711 bytes | 
| コンパイル時間 | 2,170 ms | 
| コンパイル使用メモリ | 203,256 KB | 
| 最終ジャッジ日時 | 2025-02-21 17:59:22 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | WA * 4 RE * 25 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    auto ask = [&](string &ans){
        int v;
        cout << "? " << ans << endl;
        cin >> v;
        return v;
    };
    string ans, t(n, 'a');
    for(int i = 0; i < n; i++){
        vector<pair<char, int>> pos(25);
        for(int j = 0; j < 25; j++){
            t[i] = j + 'a';
            pos[i] = make_pair(ask(t), i + 'c');
        }
        sort(pos.rbegin(), pos.rend());
        if(pos[0].first > pos[1].first){
            ans += pos[0].second;
        }else{
            ans += 'z';
        }
    }
    cout << "! " << ans << endl;
}