QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#600026#8829. AibohphobiaxydCatGirl#WA 0ms3660kbC++23615b2024-09-29 14:12:532024-09-29 14:12:53

Judging History

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

  • [2024-09-29 14:12:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3660kb
  • [2024-09-29 14:12:53]
  • 提交

answer

#include <iostream>
using namespace std;
int main()
{
    int t; cin >> t; while (t--) {
        string s; cin >> s;
        if (size(s) < 2) { cout << "Yes\n" << s << '\n'; }
        int d(0), e(0), a[26] = {}; char c;
        for (char i : s) ++a[i - 'a'];
        for (int i(0); i < 26; ++i) if (a[i]) { if (!e || a[i] < e) c = i + 'a', e = a[i]; ++d; }
        if (d < 2 || (e > 1 && d < 3)) { cout << "No\n"; continue; }
        s = ""; s.push_back(c); --a[c - 'a'];
        for (int i(0); i < 26; ++i) while (a[i]--) s.push_back(i + 'a');
        cout << "Yes\n" << s << '\n';
    } return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3660kb

input:

5
a
sos
abba
icpc
tenet

output:

Yes
a
No
Yes
oss
No
Yes
iccp
Yes
neett

result:

wrong answer Jury found the answer but participant didn't (test case 2)