Submission #277080

#TimeUsernameProblemLanguageResultExecution timeMemory
277080ec1117Poi (IOI09_poi)C++17
100 / 100
1070 ms17532 KiB
//#include "bits/stdc++.h"; #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> using namespace std; #define pb push_back #define mp make_pair int n, t, p; int main() { cin >> n >> t >> p; p--; int taskSolved[t]; vector<int> pSolved[n]; int pscore[n]; for(int i=0;i<t;i++) taskSolved[i]=0; for(int i=0;i<n;i++) pscore[i]=0; for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { int x; cin >> x; if (x == 1) { taskSolved[j]++; pSolved[i].push_back(j); } } } for (int i = 0; i < t; i++) { taskSolved[i] = n - taskSolved[i]; } vector<pair<pair<int,int>,int> >standings; for(int i=0;i<n;i++){ for(int j:pSolved[i]){ pscore[i]+=taskSolved[j]; } standings.pb(mp(mp(pscore[i],pSolved[i].size()),-i)); } sort(standings.begin(),standings.end()); int rank=0, score=0; for(int i=n-1;i>=0;i--){ if(standings[i].second==-p){ rank=n-i; score=standings[i].first.first; break; } } cout << score << ' '<<rank; return 0; } /* * need to sort by custom comparator: * need to know score, tasks solved, id */
#Verdict Execution timeMemoryGrader output
Fetching results...