| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1301593 | liangjeremy | Password (RMI18_password) | C++20 | 0 ms | 0 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
*/
