Submission #1301594

#TimeUsernameProblemLanguageResultExecution timeMemory
1301594liangjeremyPassword (RMI18_password)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#include<bits/extc++.h> #define fi first #define se second #define int long long using namespace std; //using namespace __gnu_pbds; using db=double; using ll=int64_t; using sll=__int128; using lb=long double; mt19937 rng(random_device{}()); int query(string s); string guess(int n, int s){ priority_queue<pair<int,string>,vector<pair<int,string>>,greater<pair<int,string>>>pq; for(int i=0; i<s; i++){ string cur=""; for(int j=0; j<n; j++)cur+=char('a'+i); int len=query(cur); cur=""; for(int j=0; j<len; j++)cur+=char('a'+i); pq.push({len,cur}); } auto merge=[&](string s1, string s2){ string cur=s1; int idx=0; for(char x:s2){ while(true){ string nwcur=""; for(int k=0; k<idx; k++)nwcur+=cur[k]; nwcur+=x; for(int k=idx; k<(int)cur.size(); k++)nwcur+=cur[k]; if(query(nwcur)==nwcur.size()){ cur=nwcur; idx++; break; }else idx++; } } return cur; }; while(pq.size()>1){ string s1=pq.top().se; pq.pop(); string s2=pq.top().se; pq.pop(); string s=merge(s1,s2); pq.push({s.size(),s}); } cout<<pq.top().se<<'\n'; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(long long int, long long int)':
password.cpp:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
/usr/bin/ld: /tmp/ccZPN7JI.o: in function `main':
grader.cpp:(.text.startup+0x6c): undefined reference to `guess[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status