Submission #799127

#TimeUsernameProblemLanguageResultExecution timeMemory
799127elotelo966Med (COCI22_med)C++17
50 / 50
27 ms376 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define OYY 1000000005 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define mid (start+end)/2 #define mod 1000000007 vector <pair<int,string>> v; int32_t main(){ faster int n;cin>>n; for(int i=0;i<n;i++){ string s;cin>>s; int deg,sum=0; for(int j=0;j<5;j++){ cin>>deg; sum+=deg; } v.push_back({-sum,s}); } for(int i=0;i<n;i++){ vector <pair<int,string>> deg=v; string isim=deg[i].second; for(int j=0;j<n;j++){ if(deg[j].second==isim){ deg[j].first-=500; } } sort(deg.begin(),deg.end()); // reverse(deg.begin(),deg.end()); for(int j=0;j<n;j++){ if(deg[j].second==isim){ cout<<j+1<<" "; } } for(int j=0;j<n;j++){ if(isim==deg[j].second){ deg[j].first+=500; } else deg[j].first-=500; } sort(deg.begin(),deg.end()); // reverse(deg.begin(),deg.end()); for(int j=0;j<n;j++){ if(deg[j].second==isim){ cout<<j+1<<'\n'; } } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...