# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
359455 | lakshith_ | Poi (IOI09_poi) | C++14 | 673 ms | 16108 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 tasks;
int score;
};
bool comp(student s1,student s2){
if(s1.score>s2.score)return true;
else if(s1.score<s2.score)return false;
else if(s1.tasks>s2.tasks)return true;
else if(s1.tasks<s2.tasks)return false;
else return (s1.id<s2.id);
}
int main(){
int n,t,p;
cin >> n >> t >> p;
p--;
vector<int> scores(t,n);
vector<vector<int>> vec;
for(int i=0;i<n;i++){
vector<int> v;
for(int j=0;j<t;j++){
int a;
cin >> a;
if(a==1){
scores[j]--;
v.push_back(j);
}
}
vec.push_back(v);
}
//for(int x:scores)cout << x << "\t";
//cout << "\n";
vector<student> students;
for(int i=0;i<n;i++){
int score = 0;
for(int x:vec[i])score += scores[x];
students.push_back({i,vec[i].size(),score});
//cout << i << "\t" << vec[i].size() << "\t" << score << "\n";
}
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";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |