QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#662777#8829. Aibohphobiadaoqi#WA 0ms3528kbC++20947b2024-10-21 10:18:092024-10-21 10:18:10

Judging History

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

  • [2024-10-21 10:18:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2024-10-21 10:18:09]
  • 提交

answer

#include<bits/stdc++.h>

using i64 = long long;
using l64 = long double;

void DAOQI() {
    std::string s, t;
    std::cin >> s;
    if (s.size() == 1) {
        std::cout << s << "\n";
        return;
    }
    std::vector<int> a(26);
    for (char c: s) a[c - 'a']++;
    for (int i = 0; i < 26; i++) {
        if (a[i] == 0) continue;
        t += char(i + 'a');
        for (int j = i + 1; j < 26; j++) {
            t += std::string(a[j], j + 'a');
        }
        t += std::string(a[i] - 1, i + 'a');
        break;
    }
    for (int l = 0, r = t.size() - 1; l < r; l++, r--) {
        if (t[l] != t[r]) {
            std::cout << "YES\n";
            std::cout << t << "\n";
            return;
        }
    }
    std::cout << "NO\n";
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int T = 1;
    std::cin >> T;
    while (T--) DAOQI();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
a
sos
abba
icpc
tenet

output:

a
YES
oss
NO
YES
cipc
YES
entte

result:

wrong answer Token parameter [name=yes/no] equals to "a", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)