Submission #305152

# Submission time Handle Problem Language Result Execution time Memory
305152 2020-09-22T16:04:24 Z bigDuck Password (RMI18_password) C++14
30 / 100
1347 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
//#define int ll

int t, n, m, k, a[300010], q, l, r;

int cnt[300];



int query(string str);


string guess(int n, int s){

for(char c='a'; c<=('a'+s-1); c++){
    string st;
    for(int i=1; i<=n; i++){
        st+="a"; st[st.length()-1]+=(c-'a');
    }
    cnt[c]=query(st);
}
string res;
for(int i=1; i<=n; i++){
    for(char c1='a'; c1<='z'; c1++){
        if(cnt[c1]==0){continue;}
        bool v=true;
        for(char c2='a'; (c2<='z') && (v==true) ; c2++){
            if( (cnt[c2]==0) || c2==c1){
                continue;
            }string s2="a"; s2[0]+=(c1-'a');
            for(int j=i+1; j<=n; j++){
                s2+="a"; s2[s2.length()-1]+=(c2-'a');
            }
                int ac=query(res+s2);
                if((ac-i)<cnt[c2]){
                    v=false;
                }
        }
        if(!v){continue;}
        res+="a"; res[res.length()-1]+=(c1-'a');
        cnt[c1]--;
        break;
    }
}
return res;
}


Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:29:9: warning: array subscript has type 'char' [-Wchar-subscripts]
   29 |     cnt[c]=query(st);
      |         ^
password.cpp:34:16: warning: array subscript has type 'char' [-Wchar-subscripts]
   34 |         if(cnt[c1]==0){continue;}
      |                ^~
password.cpp:37:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   37 |             if( (cnt[c2]==0) || c2==c1){
      |                      ^~
password.cpp:44:31: warning: array subscript has type 'char' [-Wchar-subscripts]
   44 |                 if((ac-i)<cnt[c2]){
      |                               ^~
password.cpp:50:13: warning: array subscript has type 'char' [-Wchar-subscripts]
   50 |         cnt[c1]--;
      |             ^~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Guessed the password with 242 queries.
2 Correct 6 ms 256 KB Guessed the password with 536 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Guessed the password with 74 queries.
2 Correct 2 ms 256 KB Guessed the password with 186 queries.
3 Correct 6 ms 256 KB Guessed the password with 403 queries.
4 Correct 7 ms 256 KB Guessed the password with 551 queries.
# Verdict Execution time Memory Grader output
1 Correct 567 ms 256 KB Guessed the password with 30259 queries.
2 Correct 792 ms 376 KB Guessed the password with 42216 queries.
3 Correct 1002 ms 372 KB Guessed the password with 48544 queries.
4 Incorrect 1347 ms 376 KB Could not guess the password with 50000 queries.
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Guessed the password with 242 queries.
2 Correct 6 ms 256 KB Guessed the password with 536 queries.
3 Correct 1 ms 256 KB Guessed the password with 74 queries.
4 Correct 2 ms 256 KB Guessed the password with 186 queries.
5 Correct 6 ms 256 KB Guessed the password with 403 queries.
6 Correct 7 ms 256 KB Guessed the password with 551 queries.
7 Correct 567 ms 256 KB Guessed the password with 30259 queries.
8 Correct 792 ms 376 KB Guessed the password with 42216 queries.
9 Correct 1002 ms 372 KB Guessed the password with 48544 queries.
10 Incorrect 1347 ms 376 KB Could not guess the password with 50000 queries.
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Guessed the password with 242 queries.
2 Correct 6 ms 256 KB Guessed the password with 536 queries.
3 Correct 1 ms 256 KB Guessed the password with 74 queries.
4 Correct 2 ms 256 KB Guessed the password with 186 queries.
5 Correct 6 ms 256 KB Guessed the password with 403 queries.
6 Correct 7 ms 256 KB Guessed the password with 551 queries.
7 Correct 567 ms 256 KB Guessed the password with 30259 queries.
8 Correct 792 ms 376 KB Guessed the password with 42216 queries.
9 Correct 1002 ms 372 KB Guessed the password with 48544 queries.
10 Incorrect 1347 ms 376 KB Could not guess the password with 50000 queries.