Submission #709138

# Submission time Handle Problem Language Result Execution time Memory
709138 2023-03-13T06:39:26 Z salmon Password (RMI18_password) C++14
0 / 100
34 ms 320 KB
#include <bits/stdc++.h>
using namespace std;

int query(string str);

string guess(int N, int S){
    string aas = "";

    for(int i = 1; i <= N - 30; i++){
        int s = 'a';
        int e = 'a' + S - 1;

        while(s != e){
            int m = (s + e)/2;

            string temp = aas;

            for(int i = s; i <= m; i++){
                temp.push_back(s);
            }

            if(query(temp) >= i){
                e = m;
            }
            else{
                s = m + 1;
            }
        }

        aas.push_back(s);
    }

    for(int i = max(1,N - 29); i <= N; i++){

        int s = 'a';
        int e = 'a' + S - 1;

        for(char j = s; j <= e; j++){
            aas.push_back(j);
            if(query(aas) == i){
                break;
            }
            else{
                aas.pop_back();
            }
        }
    }

    return aas;

}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 77 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 320 KB Returned early from guess() after 3324 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -