QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#458851 | #8829. Aibohphobia | ucup-team3659# | WA | 1ms | 3484kb | C++17 | 1.1kb | 2024-06-29 19:56:57 | 2024-06-29 19:56:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int t[2005];
void test()
{
for(int i='a';i<='z';i++)
t[i]=0;
string a;
cin>>a;
int n=a.size();
if(n==1)
{
cout<<"Yes\n";
cout<<a<<"\n";
return;
}
for(int i=0;i<n;i++)
t[a[i]]++;
int cnt=0;
for(int i='a';i<='z';i++)
if(t[i])
cnt++;
if(cnt==1)
{
cout<<"No\n";
return;
}
if(cnt==2)
{
bool f=0;
for(int i='a';i<='z';i++)
if(t[i]==1)
f=1;
if(!f)
{
cout<<"No\n";
return;
}
}
int minn=0x3f3f3f3f,mint;
for(int i='a';i<='z';i++)
if(t[i]&&t[i]<minn)
{
minn=t[i];
mint=i;
}
cout<<mint<<" ";
t[mint]--;
cnt=0;
for(int i='a';i<='z';i++)
{
if(i==mint)
continue;
if(t[i])
{
t[i]--;
cout<<i<<" ";
cnt++;
if(cnt==2)
break;
}
}
for(int i=1;i<=t[mint];i++)
cout<<mint<<" ";
t[mint]=0;
for(int i='a';i<='z';i++)
while(t[i]--)
cout<<i<<" ";
cout<<"\n";
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
for(int i=1;i<=t;i++)
test();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3484kb
input:
5 a sos abba icpc tenet
output:
Yes a 111 115 115 No 105 99 112 99 110 101 116 101 116
result:
wrong answer Token parameter [name=yes/no] equals to "111", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 2)