Submission #918570

# Submission time Handle Problem Language Result Execution time Memory
918570 2024-01-30T06:54:37 Z Elvin_Fritl Password (RMI18_password) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
const int N=2e3+5, mod=1e9+7;
 
mt19937 rng(time(NULL));
 
string guess(int n, int s) {
    vector<int> v(s);
    for(int i=0;i<s;i++) {
        v[i] = i;
    }
    shuffle(v.begin() , v.end() , rng);
    string res;
    for(int i=0;i<n;i++) {
        for(int j=0;j<s;j++) {
            int tmp = query(to_string(res + char(v[j] + 'a')));
            if(tmp == i + 1) {
                res += char(v[j] + 'a');
                break;
            }
        }
    }
    return res;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:19:61: error: no matching function for call to 'to_string(std::__cxx11::basic_string<char>)'
   19 |             int tmp = query(to_string(res + char(v[j] + 'a')));
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from password.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6587:3: note: candidate: 'std::string std::__cxx11::to_string(int)'
 6587 |   to_string(int __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6587:17: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'int'
 6587 |   to_string(int __val)
      |             ~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6598:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)'
 6598 |   to_string(unsigned __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6598:22: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'unsigned int'
 6598 |   to_string(unsigned __val)
      |             ~~~~~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6606:3: note: candidate: 'std::string std::__cxx11::to_string(long int)'
 6606 |   to_string(long __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6606:18: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'long int'
 6606 |   to_string(long __val)
      |             ~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6617:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)'
 6617 |   to_string(unsigned long __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6617:27: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'long unsigned int'
 6617 |   to_string(unsigned long __val)
      |             ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6625:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)'
 6625 |   to_string(long long __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6625:23: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'long long int'
 6625 |   to_string(long long __val)
      |             ~~~~~~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6637:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)'
 6637 |   to_string(unsigned long long __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6637:32: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'long long unsigned int'
 6637 |   to_string(unsigned long long __val)
      |             ~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6648:3: note: candidate: 'std::string std::__cxx11::to_string(float)'
 6648 |   to_string(float __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6648:19: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'float'
 6648 |   to_string(float __val)
      |             ~~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6657:3: note: candidate: 'std::string std::__cxx11::to_string(double)'
 6657 |   to_string(double __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6657:20: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'double'
 6657 |   to_string(double __val)
      |             ~~~~~~~^~~~~
/usr/include/c++/10/bits/basic_string.h:6666:3: note: candidate: 'std::string std::__cxx11::to_string(long double)'
 6666 |   to_string(long double __val)
      |   ^~~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6666:25: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'long double'
 6666 |   to_string(long double __val)
      |             ~~~~~~~~~~~~^~~~~
password.cpp:19:23: error: 'query' was not declared in this scope
   19 |             int tmp = query(to_string(res + char(v[j] + 'a')));
      |                       ^~~~~