Submission #372862

#TimeUsernameProblemLanguageResultExecution timeMemory
372862lakshith_Poi (IOI09_poi)C++14
100 / 100
681 ms16236 KiB
#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 timeMemoryGrader output
Fetching results...