QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#558871 | #8829. Aibohphobia | clearlove13# | WA | 0ms | 3628kb | C++23 | 1.4kb | 2024-09-11 19:01:04 | 2024-09-11 19:01:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ull = unsigned long long;
#define ff(x) fixed << setprecision(x)
#define vel vector<long long>
#define vei vector<int>
#define ves vector<string>
#define asn ans
constexpr int inf = 0x3f3f3f3f;
constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr db EPS = 1.0e-9;
constexpr ll MOD = 998244353LL;
constexpr ll SZ = 1e6;
constexpr ll MAXN5 = 2e5 + 5;
constexpr ll MAXN6 = 2e6 + 5;
ll n, m;
ll ch[26];
void Solve(void) {
string s;
cin >> s;
fill(ch, ch + 26, 0);
//cout<<s;
for (auto c : s) {
ch[c - 'a']++;
}
// for(int i=0;i<26;i++){
// cout<<ch[i]<<'\n';
// }
int flag=1;
for (int i = 0; i < 26; i++) {
if (ch[i] == 1) {
cout << "YES" << '\n';
flag = 0;
ch[i]--;
cout << char('a' + i);
break;
}
}
if (!flag) {
for (int i = 0; i < 26; i++) {
while (ch[i] > 0) {
cout << char('a' + i);
ch[i]--;
}
}
} else {
cout << "NO" ;
}
cout<<'\n';
}
int main(void) {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
// freopen("mine.in", "r", stdin);
// freopen("mine.out", "w", stdout);
int cas = 1;
cin >> cas;
while (cas--)
Solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
5 a sos abba icpc tenet
output:
YES a YES oss NO YES iccp YES neett
result:
ok Correct (5 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
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 jtttv NO YES elnpv YES jiit 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: 3628kb
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 berrrrrrsz YES ree YES ghlryyy YES bkwwwwwxx YES gaahhis YES gklsvvvz NO YES yhhqqqqqrr YES dfffffffgs NO YES bcdnnrrrwy YES aceeellu YES fcccccwwww YES ieeeemm YES weeeessxx YES mkkkkkkpy YES deeimorz YES fhllll YES cllllluy NO NO NO NO YES cn NO YES h YES abbchiktxz YES klrrrrrxxy...
result:
wrong answer Jury found the answer but participant didn't (test case 11)