Submission #1117316

# Submission time Handle Problem Language Result Execution time Memory
1117316 2024-11-23T09:56:32 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; i<=s; j++){
        if(query(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(c[i]+c[j])==2)cnt++;
            }
        }b[cnt]=c[j];   
    }for(int j=0; j<n; j++)cout<<b[j];
}

Compilation message

password.cpp: In function 'std::string guess(long long int, long long int)':
password.cpp:10:18: error: 'i' was not declared in this scope
   10 |     for(int j=1; i<=s; j++){
      |                  ^
password.cpp:11:18: error: could not convert 'a' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   11 |         if(query(a)==1)c.push_back(a);
      |                  ^
      |                  |
      |                  char
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++){
      |                      ~^~~~~~~~~
password.cpp:18:30: error: could not convert '(((int)c.std::vector<char>::operator[](((std::vector<char>::size_type)i))) + ((int)c.std::vector<char>::operator[](((std::vector<char>::size_type)j))))' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   18 |                 if(query(c[i]+c[j])==2)cnt++;
password.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^