Submission #199689

#TimeUsernameProblemLanguageResultExecution timeMemory
199689zoooma13Password (RMI18_password)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.cpp" using namespace std; string merge(string s ,string t){ for(int j=(int)s.size(),i=(int)t.size()-1; ~i; i--){ while(true){ string q = s; q.insert(q.begin()+j ,t[i]); if(query(q) == q.size()){ s = q; break; } j--; } } return s; } string guess(int n ,int s){ vector <string> vs; for(int x,i=0; i<s; i++){ x = query(string(n ,'a'+i)); if(x) vs.push_back(string(x ,'a'+i)); } while(vs.size()>1){ sort(vs.begin() ,vs.end() ,[](string s ,string t){ return s.size() > t.size(); }); string x = vs.back(); vs.pop_back(); string y = vs.back(); vs.pop_back(); vs.push_back(merge(x ,y)); } return vs.front(); }

Compilation message (stderr)

password.cpp: In function 'std::__cxx11::string merge(std::__cxx11::string, std::__cxx11::string)':
password.cpp:10:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(query(q) == q.size()){
                ~~~~~~~~~^~~~~~~~~~~
/tmp/ccpjI1tL.o: In function `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccBHSuTP.o:password.cpp:(.text+0x13a0): first defined here
/tmp/ccpjI1tL.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccBHSuTP.o:password.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status