Submission #539165

#TimeUsernameProblemLanguageResultExecution timeMemory
539165astoriaPoi (IOI09_poi)C++14
100 / 100
582 ms23760 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N,T,P; cin >> N >> T >> P; P--; int taskssolved[N][T]; int score[T] = {0}; for (int i=0; i<N; i++){ for (int j=0; j<T; j++){ cin >> taskssolved[i][j]; if (taskssolved[i][j] == 0) score[j]++; } } int scores[N] = {0}; for (int i=0; i<N; i++){ for (int j=0; j<T; j++){ if (taskssolved[i][j] == 1) scores[i] += score[j]; } } int numsolves[N] = {0}; for (int i=0; i<N; i++){ for (int j=0; j<T; j++){ if (taskssolved[i][j] == 1) numsolves[i]++; } } for (int i=0; i<N; i++){ scores[i] = 0-scores[i]; numsolves[i] = 0-numsolves[i]; } pair<int,pair<int,int> > alltheinfo[N]; // <score, <numsolves,id> > for (int i=0; i<N; i++){ alltheinfo[i] = make_pair(scores[i], make_pair(numsolves[i],i)); } sort(alltheinfo,alltheinfo+N); for (int i=0; i<N; i++){ if (alltheinfo[i].second.second == P){ cout << 0-alltheinfo[i].first << " " << (i+1); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...