# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
704842 |
2023-03-03T05:20:25 Z |
Paul_Liao_1457 |
Med (COCI22_med) |
C++17 |
|
137 ms |
508 KB |
//記得跳題
//#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 |
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 |
# |
Verdict |
Execution time |
Memory |
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 |