제출 #1054432

#제출 시각아이디문제언어결과실행 시간메모리
1054432materePassword (RMI18_password)C++14
80 / 100
304 ms712 KiB
#include<bits/stdc++.h> using namespace std; int query(string q); string guess(int n, int s){ vector<pair<int,char> >amt; for(char i='a';i<='a'+s-1;i++){ string q=""; for(int j=1;j<=n;j++){ q+=i; } amt.push_back({query(q),i}); } sort(amt.begin(),amt.end()); // for(pair<int,char>i:amt){ // cout<<i.first<<' '<<i.second<<endl; // } string ans=""; for(int i=1;i<=n;i++) ans+=amt.back().second; set<pair<int,char> >rem; for(pair<int,char>i:amt) rem.insert(i); for(pair<int,char>i:amt){ rem.erase(i); for(int num=i.first;num>=1;num--){ string pr=""; for(int k=1;k<=num;k++) pr+=i.second; int raod=0; for(pair<int,char> j:rem){ string qu=pr; for(int k=1;k<=j.first;k++){ qu+=j.second; } raod+=query(qu)-num; } int cur=n-1; if(ans[cur]!=amt.back().second) raod++; while(raod){ cur--; raod--; if(ans[cur]!=amt.back().second) raod++; } ans[cur]=i.second; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...