Submission #872993

#TimeUsernameProblemLanguageResultExecution timeMemory
872993HossamHero7Med (COCI22_med)C++14
50 / 50
118 ms524 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' bool cmp(pair<ll,string> p1 , pair<ll,string> p2){ if(p1.first > p2.first) return 1; if(p1.first < p2.first) return 0; return p1.second < p2.second; } void solve(){ int n; cin>>n; vector<pair<string,array<ll,5>>> v(n); for(int i=0;i<n;i++) { cin>>v[i].first; for(int j=0;j<5;j++) cin>>v[i].second[j]; } for(int i=0;i<n;i++){ vector<pair<ll,string>> tmp; for(int j=0;j<n;j++){ ll sum = 0; sum += v[j].second[0]; sum += v[j].second[1]; sum += v[j].second[2]; sum += v[j].second[3]; sum += v[j].second[4]; if(j == i) sum += 500; tmp.push_back({sum,v[j].first}); } sort(tmp.begin(),tmp.end(),cmp); for(int j=0;j<n;j++){ if(tmp[j].second == v[i].first) { cout<<j+1<<' '; break; } } tmp.clear(); for(int j=0;j<n;j++){ ll sum = 0; sum += v[j].second[0]; sum += v[j].second[1]; sum += v[j].second[2]; sum += v[j].second[3]; sum += v[j].second[4]; if(j != i) sum += 500; tmp.push_back({sum,v[j].first}); } sort(tmp.begin(),tmp.end(),cmp); for(int j=0;j<n;j++){ if(tmp[j].second == v[i].first) { cout<<j+1<<endl; break; } } } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...