Submission #663647

# Submission time Handle Problem Language Result Execution time Memory
663647 2022-11-27T03:51:59 Z Nursik Password (RMI18_password) C++14
0 / 100
30 ms 304 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 is[30];
int query(string str);
string guess(int n, int s){
    string ans = "";
    int mx = 0, c = -1;
    for (int i = 0; i < s; ++i){
        string lol = "";
        char ch = 'a';
        ch += i;
        for (int j = 1; j <= n; ++j){
            lol += ch;
        }
        int kek = query(lol);
        if (kek > mx){
            mx = kek;
            c = i;
        }
        is[i] = kek;
    }
    for (int j = 1; j <= mx; ++j){
        char ch = 'a';
        ch += c;
        ans += ch;
    }
    is[c] = 0;
    for (int i = 0; i < s; ++i){
        if (is[i] == 0){
            continue;
        }
        string add = "";
        char ch = 'a';
        ch += i;
        for (int j = 1; j <= is[i]; ++j){
            add += ch;
        }
        int len = (int)ans.size();
        string nans = "";
        for (int j = 0; j <= len; ++j){
            string q = "";
            for (int k = 0; k < j; ++k){
                q += ans[k];
            }
            q += add;
            for (int k = j; k < len; ++k){
                q += ans[k];
            }
            int kek = query(q);
            if (kek > len){
                int x = kek - len;
                for (int k = 1; k <= x; ++k){
                    nans += ch;
                    add.pop_back();
                }
                is[i] -= x;
            }
            if (j < len)
                nans += ans[j];
        }
        ans = nans;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 30 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 304 KB Returned early from guess() after 2562 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -