Submission #597618

#TimeUsernameProblemLanguageResultExecution timeMemory
597618l_rehoPoi (IOI09_poi)C++14
0 / 100
670 ms18216 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int N, K, P; vector<vector<int>> V; vector<int> S; bool compare(array<int, 3> a1, array<int, 3> a2){ return a1[0] < a2[0] || ((a1[0] == a2[0] && a1[1] < a2[1]) || (a1[1] < a2[1] && a1[2] < a2[2])); } void solve(){ cin>>N>>K>>P; V.assign(N, vector<int>(K, 0)); S.assign(K, 0); for(int i = 0; i < N; i++) for(int j = 0; j < K; j++) cin>>V[i][j]; for(int i = 0; i < K; i++){ for(int j = 0; j < N; j++){ S[i]+=V[j][i]; } S[i] = N-S[i]; } vector<array<int, 3>> A(N); // faccio cose for(int i = 0; i < N; i++){ int points = 0, solved = 0; for(int j = 0; j < K; j++){ solved += V[i][j]; if(V[i][j]) points += S[j]; } A[i] = array<int,3>{points, solved, i}; } sort(A.begin(), A.end(), compare); for(int i = 0; i < N; i++) if(A[i][2] == P-1){cout<<A[i][0]<<" "<<i+1<<endl; break;} } int main(){ solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...