This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//記得跳題
//#pragma GCC optimize("O4,unroll_loops")
//#pragma GCC target("avx2")
#include<iostream>
#include<array>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<tuple>
#include<random>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define AC ios::sync_with_stdio(0);
using namespace std;
int sc[505][10], sum[505];
string s[505];
bool cmp(pair<int, string> a, pair<int, string> b) {
if (a.F != b.F) return a.F > b.F;
return a.S < b.S;
}
signed main(){
AC;
int n; cin >> n;
FOR (i, 0, n) {
cin >> s[i];
FOR (j, 0, 5) {
cin >> sc[i][j]; sum[i] += sc[i][j];
}
}
FOR (i, 0, n) {
vector<pair<int, string> > v;
FOR (j, 0, n) if (i != j) {
v.pb({sum[j], s[j]});
}
v.pb({sum[i] + 500, s[i]});
sort(v.begin(), v.end(), cmp);
FOR(j, 0, n) if(v[j].S == s[i]) {
cout << j + 1 << " ";
break;
}
v.clear();
FOR (j, 0, n) if (i != j) {
v.pb({sum[j] + 500, s[j]});
}
v.pb({sum[i], s[i]});
sort(v.begin(), v.end(), cmp);
FOR(j, 0, n) if(v[j].S == s[i]) {
cout << j + 1 << endl;
break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |