Submission #1117349

# Submission time Handle Problem Language Result Execution time Memory
1117349 2024-11-23T10:55:53 Z Ciprian Password (RMI18_password) C++14
0 / 100
217 ms 712 KB
#include <bits/stdc++.h>
using namespace std;
int query(string s);
string guess(int n, int s){
    char a='a';
    vector<char>c;
    
    map<char, int>cnt;
    for(int j=1; j<=s; j++){
        if(query(string(1,a))==1){
            c.push_back(a);
            cnt[a]=query(string(n, a));
        }
        a++;
    }
    string w;
    for(int i=1; i<=n; i++){
        char x=c[0];
        for(int j=1; j<c.size(); j++){
            if(query(w+c[j]+string(cnt[x], x))==w.size()+cnt[x]+1){
                x=c[j];
            }   
        }w+=x;
        cnt[x]--;
    }
    
    return w;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(int j=1; j<c.size(); j++){
      |                      ~^~~~~~~~~
password.cpp:21:47: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             if(query(w+c[j]+string(cnt[x], x))==w.size()+cnt[x]+1){
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 336 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 612 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 217 ms 712 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 336 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 336 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -