# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
847069 |
2023-09-09T05:55:22 Z |
Pacybwoah |
Med (COCI22_med) |
C++17 |
|
87 ms |
456 KB |
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
bool cmp(pair<string,int> a,pair<string,int> b){
if(a.second==b.second) return a.first<b.first;
return a.second>b.second;
}
int main(){
int n;
cin>>n;
vector<pair<string,int> > vec(n);
for(int i=0;i<n;i++){
cin>>vec[i].first;
int sum=0,tmp;
for(int i=0;i<5;i++) cin>>tmp,sum+=tmp;
vec[i].second=sum;
}
for(int i=0;i<n;i++){
vector<pair<string,int> > s=vec;
s[i].second+=500;
sort(s.begin(),s.end(),cmp);
for(int j=0;j<n;j++){
if(s[j].first==vec[i].first){
cout<<j+1<<' ';
s[j].second-=1000;
break;
}
}
sort(s.begin(),s.end(),cmp);
for(int j=0;j<n;j++){
if(s[j].first==vec[i].first){
cout<<j+1<<'\n';
break;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
41 ms |
344 KB |
Output is correct |
6 |
Correct |
81 ms |
456 KB |
Output is correct |
7 |
Correct |
48 ms |
344 KB |
Output is correct |
8 |
Correct |
87 ms |
344 KB |
Output is correct |
9 |
Correct |
24 ms |
348 KB |
Output is correct |