Submission #1117318

# Submission time Handle Problem Language Result Execution time Memory
1117318 2024-11-23T10:00:37 Z Ciprian Password (RMI18_password) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 
int query(string s);
string guess(int n, int s){
    char a='a';
    vector<char>c;
    char b[30];
    for(int j=1; j<=s; j++){
        if(query(string(1,a))==1)c.push_back(a);
        a++;
    }
    for(int j=0; j<c.size(); j++){
        int cnt=0;
        for(int i=0; i<c.size(); i++){
            if(j!=i){
                if(query(string(1,c[i])+c[j])==2)cnt++;
            }
        }b[cnt]=c[j];   
    }string w;
    for(int j=0; j<n; j++)w+=b[j];
    return w;
}

Compilation message

password.cpp: In function 'std::string guess(long long int, long long int)':
password.cpp:14:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int j=0; j<c.size(); j++){
      |                  ~^~~~~~~~~
password.cpp:16:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int i=0; i<c.size(); i++){
      |                      ~^~~~~~~~~
/usr/bin/ld: /tmp/ccho3x6O.o: in function `main':
grader.cpp:(.text.startup+0x66): undefined reference to `guess[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status