#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define fastIO cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
#define mid ((l + r) / 2)
#define lChild ((index * 2) + 1)
#define rChild ((index * 2) + 2)
using namespace std;
struct node {
ll x;
string name;
};
bool cmp(node a, node b) {
if(a.x == b.x) {
return string(a.name) < string(b.name);
}
return a.x > b.x;
}
ll getMx( vector<node> arr, ll j) {
arr[j].x += 500;
string name = arr[j].name;
sort(arr.begin(), arr.end(), cmp);
for(int i = 0; i < arr.size(); i++) {
if(arr[i].name == name) return i + 1;
}
return -1;
}
ll getMin( vector<node> arr, ll j) {
for(int i = 0; i < arr.size(); i++) {
if(i == j) continue;
arr[i].x += 500;
}
string name = arr[j].name;
sort(arr.begin(), arr.end(), cmp);
for(int i = 0; i < arr.size(); i++) {
if(arr[i].name == name) return i + 1;
}
return -1;
}
void solve(ll _) {
ll n; cin>>n;
vector<node> arr(n);
for(int i = 0; i < n; i++) {
cin>>arr[i].name;
ll sum = 0;
for(int j = 0; j < 5; j++) {
ll x; cin>>x;
sum += x;
}
arr[i].x = sum;
}
sort(arr.begin(), arr.end(), cmp);
for(int i = 0; i < n; i++) {
cout<<getMx(arr, i)<<" "<<getMin(arr, i)<<endl;
}
}
int main() {
//freopen("file.in", "r", stdin);
//freopen("file.out", "w", stdout);
ll t = 0; solve(t);
}
Compilation message
Main.cpp: In function 'long long int getMx(std::vector<node>, long long int)':
Main.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int i = 0; i < arr.size(); i++) {
| ~~^~~~~~~~~~~~
Main.cpp: In function 'long long int getMin(std::vector<node>, long long int)':
Main.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(int i = 0; i < arr.size(); i++) {
| ~~^~~~~~~~~~~~
Main.cpp:51:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | for(int i = 0; i < arr.size(); i++) {
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |