Submission #650744

#TimeUsernameProblemLanguageResultExecution timeMemory
650744muazhussainPoi (IOI09_poi)C++17
0 / 100
230 ms23772 KiB
#include <bits/stdc++.h> using namespace std; bool func(const pair<pair<int,int>,int>p1, const pair<pair<int,int>,int> p2){ if(p1.first.second!=p2.first.second){ return p1.first.second<p2.first.second; }else if(p1.second!=p2.second){ return p1.second<p2.second; } return p1.first.first<p2.first.first; } void solve(){ int N,T,P; cin>>N>>T>>P; int ar[N][T]; vector<int>mark(T,N); vector<int>task(N); for(int i=0;i<N;i++){ for(int j=0;j<T;j++){ cin>>ar[i][j]; if(ar[i][j]){ mark[j]--; task[i]++; } } } vector<pair<pair<int,int>,int>>res; for(int i=1;i<=N;i++){ int score=0; for(int j=0;j<T;j++){ score+=(ar[i-1][j]*mark[j]); } res.push_back({{i,score},task[i-1]}); } // for(auto e:res){ // cout<<"id: "<<e.first.first<<" score: "<<e.first.second<<" task: "<<e.second<<endl; // } sort(res.begin(), res.end(),func); // for(auto e:res){ // cout<<"id: "<<e.first.first<<" score: "<<e.first.second<<" task: "<<e.second<<endl; // } int cnt=1; for(auto e:res){ if(e.first.first==P){ cout<<e.first.second<<" "<<cnt<<"\n"; return; } cnt++; } } int main(){ ios::sync_with_stdio(0);cin.tie(0); int T=1; // cin>>T; while(T--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...