Submission #1113490

#TimeUsernameProblemLanguageResultExecution timeMemory
1113490ZflopPoi (IOI09_poi)C++14
100 / 100
402 ms24040 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; int N,M,P,A[2001][2001],scor_problema[2001]; void solve() { cin >> N >> M >> P; for (int i = 1; i <= N;++i) { for (int j = 1; j <= M;++j) cin >> A[i][j]; } for (int j = 1; j <= M;++j) for (int i = 1; i <= N;++i) scor_problema[j] += !A[i][j]; vector<vector<int>>jucatori; for (int i = 1; i <= N;++i) { int scor = 0,tasks = 0; for (int j = 1; j <= M;++j) { if (A[i][j]) { ++tasks; scor += scor_problema[j]; } } jucatori.push_back({scor,tasks,i}); } sort(jucatori.begin(),jucatori.end(),[&](vector<int>a,vector<int>b) { if (a[0] != b[0]) return a[0] > b[0]; if (a[1] != b[1]) return a[1] > b[1]; return a[2] < b[2]; }); for (int i = 0; i < N;++i) if (jucatori[i][2] == P) cout << jucatori[i][0] << ' ' << i + 1 << '\n'; } int main() { solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...