QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#603564 | #9370. Gambling on Choosing Regionals | Retr00 | WA | 0ms | 3616kb | C++20 | 964b | 2024-10-01 17:20:41 | 2024-10-01 17:20:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;
int main()
{
ll n, k, c, x = inf;
cin >> n >> k;
vector<string> sch(n + 1);
vector<ll> gp, w(n + 1, 0), bl(n + 1, 0);
map<string, vector<ll>> s;
for (int i = 1; i <= k; i++)
cin >> c, x = min(x, c);
for (int i = 1; i <= n; i++)
{
cin >> w[i] >> sch[i];
s[sch[i]].push_back(w[i]);
}
for (auto p : s)
sort((p.second).begin(), (p.second).end(), greater<ll>());
for (auto p : s)
for (int j = 0; j < (p.second).size() && j < x; j++)
gp.push_back((p.second)[j]);
sort(gp.begin(), gp.end());
for (int i = 1; i <= n; i++)
{
ll rk = gp.size() - (upper_bound(gp.begin(), gp.end(), w[i]) - gp.begin()) + 1;
if (s[sch[i]].size() > x && w[i] < s[sch[i]][x - 1])
rk--;
cout << rk << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
5 3 1 2 3 100 THU 110 PKU 95 PKU 105 THU 115 PKU
output:
2 1 2 2 1
result:
ok 5 lines
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
5 2 2 3 100 THU 110 PKU 95 PKU 105 THU 115 PKU
output:
3 1 4 2 1
result:
wrong answer 1st lines differ - expected: '4', found: '3'