| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|
| 1296922 | | qrn | Med (COCI22_med) | C++20 | | 19 ms | 4168 KiB |
//ome47
#include "bits/stdc++.h"
using namespace std;
#define intt long long
#define fi first
#define se second
const intt mxN = 1e5 + 5;
const intt LG = 20;
const intt inf = 1e18;
vector<intt> points(mxN);
vector<string> mp(mxN);
bool cmp(intt &a, intt &b) {
if(points[a]==points[b]){
return mp[a]<mp[b];
}
return points[a]>points[b];
}
void _() {
intt n;
cin >> n;
for(intt i = 0; i < n; i++) {
string s;
cin >> s;
mp[i+1]=s;
intt sum = 0;
for(intt j = 0; j < 5; j++) {
intt x;
cin>>x;
sum += x;
}
points[i+1]=sum;
}
for(intt i = 1; i <= n; i++) {
vector<intt> ranking;
for(intt j=1;j<=n;j++) ranking.push_back(j);
intt best = 0, worst = 0;
for(intt j=1;j<=n;j++){
if(i!=j)points[j]+=500;
}
sort(ranking.begin(), ranking.end(), cmp);
for(intt j=0;j<n;j++){
if(ranking[j] == i) {
worst = j + 1;
break;
}
}
for(intt j=1;j<=n;j++){
if(i!=j)points[j]-=500;
else points[j]+=500;
}
sort(ranking.begin(), ranking.end(), cmp);
for(intt j=0;j<n;j++){
if(ranking[j] == i) {
best = j + 1;
break;
}
}
for(intt j=1;j<=n;j++) {
if(i==j)points[j]-=500;
}
cout << best << " " << worst << endl;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
intt t = 1, buu = 1;
// cin >> t;
while(t--){
// cout << "Case #" << buu++ << ": ";
_();
}
}
// ⠀⠀⠀⠀⠀⠀⠀⢀⣤⣦⣶⣤⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⣤⢀⣀⡀⣠⣄⣠⣶⣿⣿⣿⣿⣿⣿⣿⣷⣾⡦⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠻⡳⢛⠛⠒⠚⢛⣿⣿⠟⠋⠉⠛⠛⢿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀
// ⢛⡛⢿⣿⠟⠻⠛⣿⣇⣶⣖⣤⣀⣄⡰⣹⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀
// ⢿⠿⠿⠿⠿⠿⠿⢭⣐⠠⢼⣬⠽⢈⢁⡿⠛⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⣛⣱⣤⣤⣤⣀⣄⣄⣗⢌⠋⠉⢙⣴⣧⢤⣤⣤⣤⣦⡀⠀⠀⠀⠀⢺⡿
// ⣿⣿⣿⠟⠛⠋⠀⡬⠼⢠⠍⠂⠀⠨⡇⠀⡏⠉⠛⢿⣧⠀⠀⠀⠀⢸⣀
// ⣟⠄⠀⠀⠀⠀⠀⢡⠀⠀⠀⠀⠀⡠⠁⢀⠁⠀⠀⠀⠘⣗⢀⠄⢶⣼⣾
// ⠀⠀⠀⢠⣦⠇⠀⠀⠁⠒⠒⠒⠈⠀⠀⠀⣞⢶⡀⠀⠀⠹⣧⣠⡞⣸⣏
// ⠀⠀⢀⡞⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣦⡀⠀⠈⠫⣕⣻⡇
// ⠀⠀⣾⣧⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⣿⣿⣿⣷⣦⡠⡤⠀⣿⡇
// ⠠⢿⣿⣿⠂⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠴⣿⣿⣿⣿⠟⠋⢀⣤⣿⣷
// ⣀⣀⣀⣙⣃⣠⣤⣔⣤⣢⣵⣒⣒⣢⣄⣤⣄⣛⣋⣉⣀⣀⣤⣿⣿⣿⣿
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |