Submission #493862

#TimeUsernameProblemLanguageResultExecution timeMemory
493862ahmeterenPoi (IOI09_poi)C++17
100 / 100
238 ms23832 KiB
#include<bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // #ifndef ONLINE_JUDGE // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif int n, k, p; cin >> n >> k >> p; vector<int> cnt(k); vector<vector<int>> vec(n, vector<int> (k, 0)); vector<pair<pair<int, int>, int>> v; for(int i = 0; i < n; i++) { for(int j = 0; j < k; j++) { cin >> vec[i][j]; if(vec[i][j] == 0) cnt[j]++; } } for(int i = 0; i < n; i++) { int puan = 0, say = 0; for(int j = 0; j < k; j++) { if(vec[i][j]) { puan += cnt[j]; say++; } } v.push_back({{puan, say}, -i}); } sort(v.rbegin(), v.rend()); for(int i = 0; i < n; i++) { if(-v[i].second == p - 1) { cout << v[i].first.first << " " << i + 1 << '\n'; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...