QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#519769 | #8829. Aibohphobia | SocialPanda | WA | 1ms | 3664kb | C++23 | 1.2kb | 2024-08-15 01:26:06 | 2024-08-15 01:26:06 |
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,sin;
string s;
cin>>s;
int fg=0;
for(auto z:s) mp[z]++;
for(auto &z:mp)
{
if(z.se==1)
{
fg=1;
sin[z.fi]=1;
z.se=0;
}
}
if(mp.size()==1 and s.size()>1)
{
cout<<"NO"<<endl;
return;
}
if(fg)
{
cout<<"YES"<<endl;
for(auto z:sin) cout<<z.fi;
for(auto z:mp)
{
for(int i=1;i<=z.se;i++) cout<<z.fi;
}
cout<<endl;
}
else cout<<"NO"<<endl;
//ykkk
}
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt=1;
cin >> tt;
while(tt--) solve();
}
//jhjjh
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3664kb
input:
5 a sos abba icpc tenet
output:
YES a YES oss NO YES ipcc YES neett
result:
ok Correct (5 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
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 jvttt NO YES elnpv YES jtii 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: 3640kb
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 beszrrrrrr YES ree YES ghlryyy YES bkwwwwwxx YES gisaahh YES gklszvvv NO YES yhhqqqqqrr YES dgsfffffff NO YES bcdwynnrrr YES acueeell YES fcccccwwww YES ieeeemm YES weeeessxx YES mpykkkkkk YES dimorzee YES fhllll YES cuylllll NO NO NO NO YES cn NO YES h YES achiktxzbb YES klyrrrrrxx...
result:
wrong answer Jury found the answer but participant didn't (test case 11)