# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
372862 | lakshith_ | Poi (IOI09_poi) | C++14 | 681 ms | 16236 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 student{
int id;
int score;
vector<int> solved;
};
bool comp(student s1,student s2){
if(s1.score!=s2.score)return s1.score>s2.score;
if(s1.solved.size()!=s2.solved.size())return s1.solved.size() > s2.solved.size();
else return s1.id < s2.id;
}
int main(){
int n,t,p;
cin >> n >> t >> p;
int c[t];
memset(c,0,sizeof(c));
vector<student> students;
for(int i=0;i<n;i++){
student s;
for(int j=0;j<t;j++){
int a;
cin >> a;
c[j] += (a==0);
if(a==1)
s.solved.push_back(j);
}
s.id = i+1;
s.score = 0;
students.push_back(s);
}
for(int i=0;i<n;i++){
int r = 0;
for(int x:students[i].solved)r += c[x];
students[i].score = r;
}
sort(students.begin(),students.end(),comp);
for(int i =0;i<n;i++){
if(students[i].id==p){
cout << students[i].score << " " << i+1 << "\n";
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |