# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
660235 |
2022-11-21T09:22:04 Z |
berr |
Med (COCI22_med) |
C++17 |
|
1 ms |
320 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int cmp(pair<int, string> x, pair<int, string> y)
{
if(x.first<y.first) return 1;
else if(x.second<y.second) return 1;
return 0;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n; cin>>n;
vector<int> tot(n);
vector<string> s(n);
for(int i=0; i<n; i++)
{
cin>>s[i];
for(int l=0; l<5; l++)
{
int x; cin>>x;
tot[i]+=x;
}
}
reverse(s.begin(),s.end());
for(int i=0; i<n; i++)
{
vector<pair<int, string>> q, p;
for(int l=0; l<n; l++)
{
if(i==l) q.push_back({tot[l]+500, s[i]});
else q.push_back({tot[l], s[l]});
}
sort(q.begin(), q.end(), cmp);
int r=0;
for(int l=0; l<n; l++)
{
if(q[l].second==s[i]) r=n-l;
}
for(int l=0; l<n; l++)
{
if(i==l) p.push_back({tot[l], s[i]});
else p.push_back({tot[l]+500, s[l]});
}
sort(p.begin(), p.end(), cmp);
int j=0;
for(int l=0; l<n; l++)
{
if(p[l].second==s[i]) j=n-l;
}
cout<<r<<" "<<j<<"\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
320 KB |
Output is correct |
3 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
320 KB |
Output is correct |
3 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |