QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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;
}
詳細信息
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'