QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#612756 | #8936. Team Arrangement | Sy03 | WA | 0ms | 3532kb | C++20 | 1.9kb | 2024-10-05 12:49:07 | 2024-10-05 12:49:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
#define endl '\n'
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
#define inl inline
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a; i >= b; i--)
#define forall(i, a) for (auto &i : a)
/**
____ ___ _____
/ ___| _ _ / _ \___ /
\___ \| | | | | | ||_ \
___) | |_| | |_| |__) |
|____/ \__, |\___/____/
|___/
*/
istream &operator>>(istream &in, vector<int> &v)
{
for (auto &i : v)
in >> i;
return in;
}
ostream &operator<<(ostream &out, vector<int> &v)
{
for (auto &i : v)
out << i << " ";
return out;
}
bool _output = 0;
void solve()
{
int n;
cin >> n;
vector<pair<string, int>> a(n);
fr(i, 1, n)
{
cin >> a[i - 1].first >> a[i - 1].second;
}
auto b = a;
sort(a.begin(), a.end(), [&](pair<string, int> a, pair<string, int> b)
{ return a.second > b.second; });
int rk = 1;
map<string, int> mp;
fr(i, 1, n)
{
auto &s = a[i - 1].first;
mp[s] = rk;
if (i > 1 && a[i - 2].second == a[i - 1].second)
{
mp[s] = mp[a[i - 2].first];
}
rk++;
}
cout << "Stage: ";
string ans = "";
for (int i = 0; i < n; i++)
{
auto s = b[i].first;
int p = min(mp[s], (int)s.size());
while (p--)
{
s.pop_back();
}
ans += s;
}
if (ans.size())
ans[0] = toupper(ans[0]);
cout << ans << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int _ = 1;
if (_output)
cin >> _;
while (_--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3532kb
input:
3 2 3 1 2 2 2 4 5 100
output:
Stage:
result:
wrong answer 1st lines differ - expected: '9', found: 'Stage: '