QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#591539#6617. Encoded Strings ItzwWA 0ms3792kbC++14458b2024-09-26 16:20:202024-09-26 16:20:22

Judging History

你现在查看的是最新测评结果

  • [2024-09-26 16:20:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3792kb
  • [2024-09-26 16:20:20]
  • 提交

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'