Submission #1117329

# Submission time Handle Problem Language Result Execution time Memory
1117329 2024-11-23T10:13:39 Z somefolk Password (RMI18_password) C++14
10 / 100
9 ms 336 KB
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <complex>
#include <list>
#include <chrono>
#include <random>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define endl "\n"
// #define int long long

const int INF = 2 * 1e5 + 5;
const int MOD = 1e9 + 7;

int query(string s);

string guess(int n, int s){
    vector<char> a;
    for(char i = 0; i < s; i++){
        if(query(string(1, i+'a'))) a.push_back(i+'a');
    }

    map<char, int> pass;

    for(int i = 0; i < (int)a.size(); i++){
        int l = 0;
        for(int j = 0; j < (int)a.size(); j++){
            if(a[i] == a[j]) continue;
            if(query(string(1,a[i])+a[j]) == 1) l++;
        }
        pass[a[i]] = l;
    }

    map<int, char> sol;
    for(auto &i : pass){
        sol[i.second] = i.first;
    }

    string sol1;
    for(auto &i : sol){
        sol1+=i.second;
    }
    return sol1;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 336 KB Guessed the password with 226 queries.
2 Correct 9 ms 336 KB Guessed the password with 530 queries.
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Returned early from guess() after 5 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 336 KB Returned early from guess() after 145 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 336 KB Guessed the password with 226 queries.
2 Correct 9 ms 336 KB Guessed the password with 530 queries.
3 Incorrect 1 ms 336 KB Returned early from guess() after 5 queries.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 336 KB Guessed the password with 226 queries.
2 Correct 9 ms 336 KB Guessed the password with 530 queries.
3 Incorrect 1 ms 336 KB Returned early from guess() after 5 queries.
4 Halted 0 ms 0 KB -