Submission #632404

#TimeUsernameProblemLanguageResultExecution timeMemory
632404Hacv16Med (COCI22_med)C++17
50 / 50
97 ms400 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int MAX = 615; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; #define pb push_back #define sz(x) (int) x.size() #define fr first #define sc second #define mp make_pair #define all(x) x.begin(), x.end() #define dbg(x) cerr << #x << ": " << "[ " << x << " ]\n" int n; struct bee{ int s; string name; bee(int a = 0, string t = ""){ s = a, name = t; } bool operator < (bee other){ if(s != other.s) return s > other.s; return name < other.name; } } v[MAX]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i = 0; i < n; i++){ cin >> v[i].name; for(int j = 0; j < 5; j++){ int x; cin >> x; v[i].s += x; } } for(int i = 0; i < n; i++){ vector<bee> mxv, mnv; for(int j = 0; j < n; j++){ if(j == i) mxv.pb(bee(v[j].s + 500, v[j].name)), mnv.pb(bee(v[j].s - 500, v[j].name)); else mxv.pb(v[j]), mnv.pb(v[j]); } sort(all(mxv)); sort(all(mnv)); int mxp = 0, mnp = 0; for(int j = 0; j < n; j++) if(mxv[j].name == v[i].name) mxp = j + 1; for(int j = 0; j < n; j++) if(mnv[j].name == v[i].name) mnp = j + 1; cout << mxp << ' ' << mnp << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...