Submission #366747

#TimeUsernameProblemLanguageResultExecution timeMemory
366747kostia244Poi (IOI09_poi)C++17
100 / 100
279 ms24044 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(x) begin(x), end(x) const int maxn = 2020; int n, m, p, score[maxn], val[maxn], cnt[maxn], a[maxn][maxn]; int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m >> p; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) { cin >> a[i][j], val[j] += !a[i][j], cnt[i] += a[i][j]; } for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) score[i] += val[j]*a[i][j]; vector<array<int, 3>> f(n); for(int i = 0; i < n; i++) f[i] = {-score[i], -cnt[i], i}; sort(all(f)); int ans = 0;--p; while(f[ans][2] != p) ans++; cout << -f[ans][0] << " " << ans+1 << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...