QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#821143 | #8937. Stage: Agausscrab | Suzuranovo# | WA | 1ms | 3748kb | C++23 | 1.4kb | 2024-12-19 13:46:25 | 2024-12-19 13:46:26 |
Judging History
answer
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
using ll = long long;
void solve() {
int n; cin >> n;
vector<pair<string, int>> a(n + 1);
for (int i = 1; i <= n; ++i)
cin >> a[i].first >> a[i].second;
vector<int> idx(n + 1),rnk(n + 1);
iota(idx.begin(), idx.end(), 0);
stable_sort(idx.begin() + 1, idx.end(), [&](int l, int r) -> bool {return a[l].second > a[r].second; });
// for (int i = 1; i <= n; ++i) mp[i] = idx[i];
for (int i = 1; i <= n; ++i) {
rnk[i] = i;
int p = idx[i];
int len = a[p].first.length();
if (i > 1)
{
if (a[p].second == a[p - 1].second) rnk[i] = rnk[i - 1];
}
if (rnk[i] >= len) a[p].first = {};
else a[p].first = a[p].first.substr(0, len - rnk[i]);
}
// sort(a.begin() + 1,a.end(),[&](const auto& l,const auto& r))
cout << "Stage: ";
string ans = {};
for (int i = 1; i <= n; ++i) {
ans += a[i].first;
}
ans[0] -= 32;
cout << ans;
// cout << a[idx[mp[1]]].first[0] << a[idx[mp[1]]].first.substr(1, idx[]);
// for (int i = 2; i <= n; ++i) {
// cout << a[idx[mp[i]]].first;
// }
}
int main() {
cin.tie(nullptr)->sync_with_stdio(0);
int t = 1; //cin >> t;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3748kb
input:
4 arcos 2 gausr 5 scrail 3 bei 3
output:
Stage: Agausscrab
result:
ok single line: 'Stage: Agausscrab'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 zhe 1 jiang 3 sheng 5 sai 2
output:
Stage: Jiashen
result:
ok single line: 'Stage: Jiashen'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
1 yp 1
output:
Stage: Y
result:
ok single line: 'Stage: Y'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
2 ut 1 fg 1
output:
Stage: Uf
result:
ok single line: 'Stage: Uf'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
8 pz 1 ym 1 hi 1 mv 1 jh 1 jd 1 ok 1 lc 1
output:
Stage: Pyhmjjol
result:
ok single line: 'Stage: Pyhmjjol'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
8 cm 2 uk 2 ls 2 ay 1 vr 2 zt 1 al 2 ze 2
output:
Stage: Cul
result:
wrong answer 1st lines differ - expected: 'Stage: Culvaz', found: 'Stage: Cul'