Submission #799196

#TimeUsernameProblemLanguageResultExecution timeMemory
799196MercubytheFirstMed (COCI22_med)C++17
50 / 50
1 ms340 KiB
/* */ #include<iostream> #include<vector> #include<iomanip> #include<algorithm> #include<map> #include<set> #include<climits> #include<numeric> #include<queue> #include<unordered_map> #include<string> #include<climits> #include<unordered_set> #include<bitset> #include<cstring> #include<cmath> #include<stack> #define st first #define nd second #define endl '\n' #define fio ios_base::sync_with_stdio(false);cin.tie(NULL); #define int long long int using namespace std; bool comp(const pair<int, string>& a, const pair<int, string>& b){ if(a.st > b.st)return true; if(a.st < b.st)return false; return a.nd < b.nd; } void solve(){ int n; cin >> n; vector<pair<int, string> >vo(n), vmax(n), vmin(n); for(int i = 0; i < n; ++i){ cin >> vo[i].nd; vo[i].st = 0; int x, cnt = 5; while(cnt--){ cin >> x; vo[i].st += x; } vmax[i] = vmin[i] = vo[i]; vmax[i].st += 500; } sort(vmax.begin(), vmax.end(), comp); sort(vmin.begin(), vmin.end(), comp); cout << endl; for(int i = 0; i < n; ++i){ int worst = lower_bound(vmax.begin(), vmax.end(), vo[i], comp) - vmax.begin(); vo[i].st += 500; int best = lower_bound(vmin.begin(), vmin.end(), vo[i], comp) - vmin.begin(); best++; cout << best << ' ' << worst << endl; } } signed main(){ //fileio("test"); fio; //int t;cin >> t;while(t--) solve(); } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...