| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 641250 | lto5 | Med (COCI22_med) | C++14 | 15 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
string s[505];
int b[505][10];
int tot[505];
int n;
int idx[505];
bool cmp (const int& x, const int& y) {
if (tot[x] != tot[y])
return tot[x] > tot[y];
return s[x] < s[y];
}
int find_best (int cur_idx) {
tot[cur_idx] += 500;
sort(idx + 1, idx + 1 + n, cmp);
tot[cur_idx] -= 500;
for (int i = 1; i <= n; i++) {
if (idx[i] == cur_idx) {
return i;
}
}
}
int find_worst (int cur_idx) {
for (int i = 1; i <= n; i++) {
if (i != cur_idx)
tot[i] += 500;
}
sort(idx + 1, idx + 1 + n, cmp);
for (int i = 1; i <= n; i++) {
if (i != cur_idx)
tot[i] -= 500;
}
for (int i = 1; i <= n; i++) {
if (idx[i] == cur_idx) {
return i;
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s[i];
for (int j = 1; j <= 5; j++) {
cin >> b[i][j];
tot[i] += b[i][j];
}
idx[i] = i;
}
for (int i = 1; i <= n; i++) {
// iota(idx + 1, idx + 1 + n, 1);
// for (int j = 1; j <= n; j++)
// cout << idx[j] << " ";
// cout << "done" << endl;
cout << find_best(i) << " " << find_worst(i) << '\n';
}
return 0;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
