QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#468554#8829. AibohphobiaYMH_fourteenWA 0ms3744kbC++14928b2024-07-08 21:31:252024-07-08 21:31:25

Judging History

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

  • [2024-07-08 21:31:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3744kb
  • [2024-07-08 21:31:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "E:/OI/normal/templates/debug.h"
#else
#define dbg(...) (void)0
#define msg(...) (void)0
#endif
#define ll long long
#define endl '\n'
#define PB emplace_back
#define PPB pop_back
#define MP make_pair
#define ALL(Name) Name.begin(),Name.end()
#define PII pair<int,int>
#define VI vector<int>
#define GI greater<int>
#define fi first
#define se second



int main()
{
	ios::sync_with_stdio(false),cin.tie(nullptr);
	int _;cin>>_;while(_--)
{
	string s;cin>>s;
	int cnt[26]={};
	for(char i:s)cnt[i-'a']++;
	int id=-1,c=0;
	for(int i=0;i<26;i++)
		if(cnt[i]==1||cnt[i]&&++c==3){id=i;break;}
	if(~id)
	{
		cout<<"YES\n";
		cout<<char(id+'a');
		for(int i=0;i<26;i++)if(i!=id)for(int j=0;j<cnt[i];j++)cout<<char(i+'a');
		for(int i=1;i<cnt[id];i++)cout<<char(i+'a');
		cout<<endl;
	}
	else cout<<"NO\n";
}

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

5
a
sos
abba
icpc
tenet

output:

YES
a
YES
oss
NO
YES
iccp
YES
neett

result:

ok Correct (5 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

18
qnx
oooo
tvttj
zzzzz
pvlne
iijt
hjhjj
loo
hh
uq
mgvgv
ewwe
iii
kykk
o
mmumm
aetvv
xntl

output:

YES
nqx
NO
YES
jtttv
NO
YES
elnpv
YES
jiit
NO
YES
loo
NO
YES
qu
YES
mggvv
NO
NO
YES
ykkk
YES
o
YES
ummmm
YES
aetvv
YES
lntx

result:

ok Correct (18 test cases)

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3744kb

input:

138
gcseqpht
brrrzsrerr
ree
lgryyyh
wbxkwwwwx
hsihaga
kvvslzgv
dssd
qhrqqqrqyh
dfffffsfgf
ssuzuuzzs
rrwnyrcdnb
ealelecu
ccfwwwccwc
emeieme
xeexeswes
ymkkkkpkk
eimderoz
lflllh
lluylcll
rquqrqu
mllmllll
cscscc
ssssssssss
cn
llljlzlzj
h
kbbxahczit
yxrrrrxlkr
uikiakika
tntnnqntw
sjhxyfsy
fcyyyf
dbvbvdbw...

output:

YES
ceghpqst
YES
berrrrrrsz
YES
ree
YES
ghlryyy
YES
bkwwwwwxx
YES
gaahhis
YES
gklsvvvz
NO
YES
rhhqqqqqyb
YES
dfffffffgs
YES
zsssuuubc
YES
bcdnnrrrwy
YES
aceeellu
YES
fcccccwwww
YES
ieeeemm
YES
weeeessxx
YES
mkkkkkkpy
YES
deeimorz
YES
fhllll
YES
cllllluy
YES
uqqqrrb
NO
NO
NO
YES
cn
YES
zjjlllllb
YES
...

result:

wrong answer Not a permutation (test case 9)