QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#558892#8829. AibohphobiaAmanicus#WA 0ms3644kbC++14938b2024-09-11 19:08:422024-09-11 19:08:44

Judging History

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

  • [2024-09-11 19:08:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-09-11 19:08:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using db=double;
const ll N=1e6+5;
typedef pair<ll,ll>PLL;
#define fi first
#define se second
ll a[N];
int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	ll t,n;
	t=1;
	cin>>t;
	while(t--) {
		string s;
		cin>>s;
		ll n=s.size();
		map<char,ll>mp;
		for(ll i=0; i<n; i++) {
			mp[s[i]]++;
		}
		ll m=mp.size();
		char c='@';
		ll d=0;
		for(auto s:mp) {
			if(s.se==1)
				c=s.fi;
			else d++;
		}
		if(c!='@') {
			cout<<"YES\n";
			cout<<c;
			for(auto s:mp) {
				if(s.fi!=c) {
					for(ll i=1; i<=s.se; i++)
						cout<<s.fi;
				}
			}
			cout<<'\n';
		} else {
			if(d==2||d==1)
				cout<<"NO\n";
			else {
				while(1) {
					ll f=0;
					for(auto s:mp) {
						if(s.se>0) {
							cout<<s.fi;
							mp[s.fi]--;
							f=1;
						}
					}
					if(f==0)break;
				}
				cout<<'\n';
			}
		}
	}
}

详细

Test #1:

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

input:

5
a
sos
abba
icpc
tenet

output:

YES
a
YES
oss
NO
YES
pcci
YES
neett

result:

ok Correct (5 test cases)

Test #2:

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

input:

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

output:

YES
xnq
NO
YES
vjttt
NO
YES
velnp
YES
tiij
NO
YES
loo
NO
YES
uq
YES
mggvv
NO
NO
YES
ykkk
YES
o
YES
ummmm
YES
taevv
YES
xlnt

result:

ok Correct (18 test cases)

Test #3:

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

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
tceghpqs
YES
zberrrrrrs
YES
ree
YES
rghlyyy
YES
kbwwwwwxx
YES
saaghhi
YES
zgklsvvv
NO
YES
yhhqqqqqrr
YES
sdfffffffg
suzsuzsuz
YES
ybcdnnrrrw
YES
uaceeell
YES
fcccccwwww
YES
ieeeemm
YES
weeeessxx
YES
ykkkkkkmp
YES
zdeeimor
YES
hfllll
YES
yclllllu
qruqruq
NO
NO
NO
YES
nc
jlzjlzlll
YES
h
YES
zabbch...

result:

wrong answer Token parameter [name=yes/no] equals to "suzsuzsuz", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 11)