QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#519769#8829. AibohphobiaSocialPandaWA 1ms3664kbC++231.2kb2024-08-15 01:26:062024-08-15 01:26:06

Judging History

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

  • [2024-08-15 01:26:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3664kb
  • [2024-08-15 01:26:06]
  • 提交

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)