This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Problem: #1 - Med
// Contest: DMOJ - COCI '21 Contest 6
// URL: https://dmoj.ca/problem/coci21c6p1
// Memory Limit: 512 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
using namespace std;
#define lg long long
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
bool cmp(pair<lg, string> a, pair<lg, string> b)
{
if(a.first == b.first) return a.second < b.second;
return a.first > b.first;
}
int main()
{
fastio;
lg n;
cin >> n;
vector<pair<lg, string>> v, a, b;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
lg x = 0, y = 5;
while(y--)
{
lg z;
cin >> z;
x += z;
}
v.push_back({x, s});
}
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(i == j) a.push_back({v[j].first+500, v[j].second}), b.push_back(v[j]);
else b.push_back({v[j].first+500, v[j].second}), a.push_back(v[j]);
}
sort(a.begin(), a.end(), cmp);
sort(b.begin(), b.end(), cmp);
for(int j = 0; j < n; j++)
{
if(v[i].second == a[j].second)
{
cout << j+1 << ' ';
}
if(v[i].second == b[j].second)
{
cout << j+1 << ' ';
}
}
cout << '\n';
a.clear();
b.clear();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |