# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
277082 | ec1117 | Poi (IOI09_poi) | C++17 | 1125 ms | 9780 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h";
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
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |