//記得跳題
//#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;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
64 ms |
372 KB |
Output is correct |
6 |
Correct |
125 ms |
508 KB |
Output is correct |
7 |
Correct |
79 ms |
372 KB |
Output is correct |
8 |
Correct |
137 ms |
504 KB |
Output is correct |
9 |
Correct |
37 ms |
340 KB |
Output is correct |