QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#613211#8937. Stage: Agausscrabm107239#WA 1ms3640kbC++171.2kb2024-10-05 13:45:272024-10-05 13:45:33

Judging History

This is the latest submission verdict.

  • [2024-10-05 13:45:33]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3640kb
  • [2024-10-05 13:45:27]
  • Submitted

answer

#include <bits/stdc++.h>

using i64 = long long;

struct Node {
    std::string name;
    int v, rk, id;
};

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n;
    std::cin >> n;
    std::vector<Node> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i].name >> a[i].v;
        a[i].id = i;
    }

    std::sort(a.begin(), a.end(),
        [](Node n1, Node n2) {
            return n1.v > n2.v;
        });

    int rk = 1;
    for (int l = 0, r = 0; r < n; l = r) {
        while (r < n && a[l].v == a[r].v) {
            a[r].rk = rk;
            r++;
        }
        rk++;
    }
    for (int i = 0; i < n; i++) {
        if (a[i].name.length() < a[i].rk) {
            a[i].name = "";
            continue;
        }
        for (int j = 0; j < a[i].rk; j++) {
            a[i].name.pop_back();
        }
    }
    std::sort(a.begin(), a.end(),
        [](Node n1, Node n2) {
            return n1.id < n2.id;
        });
    std::string ans;
    for (int i = 0; i < n; i++) {
        ans += a[i].name;
    }
    if (ans.length() > 0) {
        ans[0] = std::toupper(ans[0]);
    }

    std::cout << "Stage: " << ans << '\n';

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3640kb

input:

4
arcos 2
gausr 5
scrail 3
bei 3

output:

Stage: Argausscrab

result:

wrong answer 1st lines differ - expected: 'Stage: Agausscrab', found: 'Stage: Argausscrab'