Submission #1301593

#TimeUsernameProblemLanguageResultExecution timeMemory
1301593liangjeremyPassword (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'; } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } /* Overhead the albatross hangs motionless upon the air And deep beneath the rolling waves in labyrinths of coral caves The echo of a distant time comes willowing across the sand And everything is green and submarine And no one showed us to the land And no one knows the wheres or whys But something stirs and something tries And starts to climb towards the light */

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/ccrXqZxn.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccAehurj.o:password.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccrXqZxn.o: in function `main':
grader.cpp:(.text.startup+0x6c): undefined reference to `guess[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status