Submission #309031

#TimeUsernameProblemLanguageResultExecution timeMemory
309031bigDuckPassword (RMI18_password)C++14
Compilation error
0 ms0 KiB
string guess(int n, int s){ stack<string> stv; for(char c='a'; c<=('a'+s-1); c++){ string st=""; for(int i=0; i<n; i++){st.pb(c);} int ln=query(st); if(ln==0){continue;} if(ln>0){ string s=""; for(int i=0; i<ln; i++){ s.pb(c); } stv.push(s); } } while(stv.size()>1){ stack<string> stv2; while(stv.size()>1){ string s1=stv.top(); stv.pop(); string s2=stv.top(); stv.pop(); string s3=""; int j=0, i=0; for(; i<s1.length() && j<s2.length(); i++){ bool v=false; string s4=s3; s4.pb(s1[i]); for(int k=j; k<s2.length(); k++){ s4.pb(s2[k]); } v=(query(s4)==(s4.length())); if(v){ s3.pb(s1[i]); } else{ s3.pb(s2[j]); j++; i--; } } while(i<s1.length()){ s3.pb(s1[i]); i++; } while(j<s2.length()){ s3.pb(s2[j]); j++; } stv2.push(s3); } while(!stv2.empty()){ stv.push(stv2.top()); stv2.pop(); } } return stv.top(); } /*int main(){ cout<<guess(6, 26); }*/

Compilation message (stderr)

password.cpp:3:1: error: 'string' does not name a type
    3 | string guess(int n, int s){
      | ^~~~~~