# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
873069 |
2023-11-14T11:54:10 Z |
TAhmed33 |
Med (COCI22_med) |
C++ |
|
39 ms |
756 KB |
#include <bits/stdc++.h>
using namespace std;
bool comp (pair <string, int> &a, pair <string, int> &b) {
return a.second == b.second ? a.first < b.first : a.second > b.second;
}
int main () {
int n;
cin >> n;
vector <pair <string, int>> pp;
for (int i = 0; i < n; i++) {
string t; cin >> t; int x = 0; for (int j = 0; j < 5; j++) {
int u; cin >> u; x += u;
}
pp.push_back({t, x});
}
for (int i = 0; i < n; i++) {
auto d = pp;
d[i].second += 500;
sort(d.begin(), d.end(), comp);
for (int j = 0; j < n; j++) {
if (d[j].first == pp[i].first) {
cout << j + 1 << " ";
}
}
d = pp;
d[i].second -= 500;
sort(d.begin(), d.end(), comp);
for (int j = 0; j < n; j++) {
if (d[j].first == pp[i].first) {
cout << j + 1 << '\n';
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
17 ms |
440 KB |
Output is correct |
6 |
Correct |
35 ms |
348 KB |
Output is correct |
7 |
Correct |
25 ms |
348 KB |
Output is correct |
8 |
Correct |
39 ms |
756 KB |
Output is correct |
9 |
Correct |
10 ms |
348 KB |
Output is correct |