Submission #918433

#TimeUsernameProblemLanguageResultExecution timeMemory
918433vjudge1Password (RMI18_password)C++17
0 / 100
65 ms440 KiB
#include <bits/stdc++.h> using namespace std; int query(string str); vector<int> a; bool comp(pair<int,int> x,pair<int,int> y){ if(x.first==y.first){ return x.second<y.second; } string s2=""; for(int i=0;i<x.second;i++){ s2+=char('a'+x.first); } for(int i=0;i<a[y.first]-y.second+1;i++){ s2+=char('a'+y.first); } return (query(s2)==(int)s2.size()); } string guess(int n,int s){ a.resize(s); string s1=""; for(int i=0;i<s;i++){ s1=""; for(int j=0;j<n;j++){ s1+=char('a'+i); } a[i]=query(s1); } vector<pair<int,int>> b; for(int i=0;i<s;i++){ for(int j=0;j<a[i];j++){ b.push_back(make_pair(i,j+1)); } } sort(b.begin(),b.end(),comp); s1=""; cout << b.size() << endl; for(int i=0;i<n;i++){ s1+=char('a'+b[i].first); } return s1; }
#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...