# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1089887 |
2024-09-17T11:13:21 Z |
Onur_Ilgaz |
Med (COCI22_med) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
using namespace std;
int32_t main(){
fast
int n;
cin >> n;
vector <pair<int, string> > v(n);
for(int i = 0; i < n; i++) {
cin >> v[i].second;
for(auto &it:v[i].second) {
it = 'z' - it + 'a';
}
int sum = 0;
for(int j = 0; j < 5; j++) {
int in;
cin >> in;
sum += in;
}
v[i].first = sum;
}
auto worst = v;
auto best = v;
for(auto &it:best) {
it.first += 500;
}
sort(worst.begin(), worst.end());
sort(best.begin(), best.end());
for(auto it:v) {
// for worst
pair<int, int> find;
find.second = n - (upper_bound(best.begin(), best.end(), it) - best.begin());
// for best
it.first += 500;
find.first = n - (upper_bound(worst.begin(), worst.end(), it) - worst.begin()) + 1;
cout << find.first << " " << find.second << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |