# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
797046 | pluto_ish | Poi (IOI09_poi) | C++14 | 497 ms | 23872 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;
struct d_score{
int score;
int num_problems;
int id;
};
bool cmp(d_score a, d_score b){
if(a.score == b.score){
if(a.num_problems == b.num_problems) return a.id < b.id;
return a.num_problems > b.num_problems;
}
return a.score > b.score;
}
int main(){
int n, t, p;
cin >> n >> t >> p;
vector< vector<int> > a(n, vector<int>(t, 0));
for(vector<int>& x : a){
for(int& y : x) cin >> y;
}
vector<int> pts(t, 0);
for(int i=0;i<t;i++){
for(int j=0;j<n;j++){
if(a[j][i] == 0) pts[i]++;
}
}
vector<d_score> scores(n);
for(int i=0;i<n;i++){
int np = 0, sc = 0;
for(int j=0;j<t;j++){
if(a[i][j]){
np++;
sc += pts[j];
}
}
scores[i] = d_score{sc, np, i+1};
}
sort(scores.begin(), scores.end(), cmp);
for(int i=0;i<n;i++){
if(scores[i].id == p){
cout << scores[i].score << " " << i+1 << "\n";
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |