Submission #665551

# Submission time Handle Problem Language Result Execution time Memory
665551 2022-11-27T11:58:23 Z Nursik Password (RMI18_password) C++17
20 / 100
295 ms 416 KB
#include <stdio.h>
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
#define ll long long
#define pb push_back
 

int query(string str);
string guess(int n, int s){
    string ans =  "";
    for (int i = 0; i < s; ++i){
        char ch = 'a';
        ch += i;
        int len = 0;
        len = (int)ans.length();
        string nans = "";
        for (int j = 0; j <= len; ++j){
            string add = "";
            int is = 1;
            while (1){
                add += ch;
                string q = "";
                for (int k = 0; k < j; ++k){
                    q += ans[k];
                }
                q += add;
                for (int k = j; k < len; ++k){
                    q += ans[k];
                }
                if ((int)q.length() > n)
                    break;
                int kek = query(q);
                if (kek == len + is){
                    is += 1;
                    nans += ch;
                }
                else{
                    break;
                }
            }
            if (j < len){
                nans += ans[j];
            }
        }
        ans = nans;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 300 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Guessed the password with 77 queries.
2 Correct 2 ms 208 KB Guessed the password with 176 queries.
3 Runtime error 1 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 64 ms 208 KB Guessed the password with 4818 queries.
2 Correct 145 ms 296 KB Guessed the password with 10774 queries.
3 Correct 210 ms 416 KB Guessed the password with 14385 queries.
4 Correct 295 ms 328 KB Guessed the password with 20895 queries.
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 300 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 300 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -