제출 #1327413

#제출 시각아이디문제언어결과실행 시간메모리
1327413dashkaPassword (RMI18_password)C++20
0 / 100
1 ms412 KiB
#include <bits/stdc++.h>
using namespace std;

int query(string str);

string guess(int n, int s) {
    string pw = "";
    vector<bool> used(s, false);
    
    for (int i = 0; i < n; i++) {
        for (int c = 0; c < s; c++) {
            if (used[c]) continue;
            char ch = 'a' + c;
            // pw + ch дараа ch-г n удаа давтна
            // ингэснээр ch нууц үгд байвал заавал олно
            string t = pw + string(n + 1, ch);
            if ((int)query(t) >= i + 1) {
                pw += ch;
                used[c] = true;
                break;
            }
        }
    }
    
    return pw;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...