Submission #629798

#TimeUsernameProblemLanguageResultExecution timeMemory
629798chinmoy_101Poi (IOI09_poi)C++14
0 / 100
528 ms8532 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long bool cmp(pair<int, int> a, pair<int, int> b) { if(a.second != b.second) { return a.second>b.second; } else { if(a.first != b.first) { return a.first<b.first; } } return 0; } int main() { int n, t, p; cin>>n >>t >>p; vector<int> points_for_each_task_array(t, 0); vector<vector<int> > arr(n, {0, 0}); vector<pair<int, int>> final_standing(n, {0, 0}); for(int i=0; i<n; i++) { for(int j=0; j<t; j++) { cin>>arr[i][j]; if(arr[i][j]==0) { points_for_each_task_array[j]++; } } } for(int i=0; i<n; i++) { int j=0, ans=0; for(j=0; j<t; j++) { if(arr[i][j]==1) { ans+=points_for_each_task_array[j]; } } final_standing[i]={i+1, ans}; } sort(final_standing.begin(), final_standing.end(), cmp); cout<<final_standing[p-1].second <<" " <<final_standing[p-1].first; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...