QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#591539 | #6617. Encoded Strings I | tzw | WA | 0ms | 3792kb | C++14 | 458b | 2024-09-26 16:20:20 | 2024-09-26 16:20:22 |
Judging History
answer
#include<iostream>
#include<map>
using namespace std;
int main(){
int n;
string s;
cin>>n>>s;
string ans=s;
string ss="";
for(int i=0;i<s.length();i++){
map<char,char>mp;
ss+=s[i];
int cnt=0;
for(int j=ss.length()-1;j>=0;j--){
if(!mp[ss[j]]){
mp[ss[j]]='a'+cnt;
cnt++;
}
}
string tmp=ss;
for(int j=0;j<ss.length();j++){
tmp[j]=mp[tmp[j]];
}
if(tmp>ans) ans=tmp;
}
cout<<ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3792kb
input:
4 aacc
output:
bbaa
result:
ok single line: 'bbaa'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
3 aca
output:
ba
result:
ok single line: 'ba'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3572kb
input:
1 t
output:
t
result:
wrong answer 1st lines differ - expected: 'a', found: 't'