QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519761#8829. AibohphobiaSocialPandaWA 0ms3804kbC++231.2kb2024-08-15 01:17:532024-08-15 01:17:53

Judging History

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

  • [2024-08-15 01:17:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3804kb
  • [2024-08-15 01:17:53]
  • 提交

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;
    	}
    	else
    	{
    		ou[z.fi]=z.se;
    	}
    }

    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();
}

Details

Tip: Click on the bar to expand more detailed information

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: 3580kb

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
YES
zzzzz
YES
elnpv
YES
ijti
YES
hjhjj
YES
loo
NO
YES
qu
YES
gmvgv
NO
YES
iii
YES
kykk
YES
o
YES
mummm
YES
aetvv
YES
lntx

result:

wrong answer Some prefix is a palindrome (test case 4)