QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#519764 | #8829. Aibohphobia | SocialPanda | WA | 0ms | 3804kb | C++23 | 1.3kb | 2024-08-15 01:20:34 | 2024-08-15 01:20:35 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
//#define int long long
//#define LL long long
#define double long double
//#define lf Lf
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define PII pair<int,int>
#define Gheap priority_queue<int,vector<int>,greater<int>>
#define Lheap priority_queue<int>
#define MAXN 0x3f3f3f3f
#define MINN -0x3f3f3f3f
using namespace std;
//const int N=1e6+100,M=2*N;
//int e[N],w[M],h[M],ne[M],idx;
void solve()
{
map<char,int> mp,ji,ou;
string s;
cin>>s;
int fg=0;
for(auto z:s) mp[z]++;
for(auto z:mp)
{
if(z.se%2)
{
fg=1;
//ji[z.fi]=z.se;
}
}
if(mp.size()==1 and s.size()>1)
{
cout<<"NO"<<endl;
return;
}
if(fg)
{
cout<<"YES"<<endl;
for(auto &z:mp)
{
cout<<z.fi;
z.se--;
}
for(auto z:mp)
{
for(int i=1;i<=z.se;i++) cout<<z.fi;
}
cout<<endl;
}
else cout<<"NO"<<endl;
//nttee
}
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt=1;
cin >> tt;
while(tt--) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3804kb
input:
5 a sos abba icpc tenet
output:
YES a YES oss NO YES cipc YES entet
result:
ok Correct (5 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
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 jtvtt NO YES elnpv YES ijti YES hjhjj YES loo NO YES qu YES gmvgv NO NO YES kykk YES o YES mummm YES aetvv YES lntx
result:
wrong answer Some prefix is a palindrome (test case 7)