Submission #346485

#TimeUsernameProblemLanguageResultExecution timeMemory
346485MilosMilutinovicPoi (IOI09_poi)C++14
100 / 100
299 ms23916 KiB
/** * author: milos * created: 10.01.2021 01:42:54 **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, t, id; cin >> n >> t >> id; --id; vector<vector<int>> a(n, vector<int>(t)); vector<int> cnt(t, 0); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { cin >> a[i][j]; cnt[j] += a[i][j]; } } vector<int> p(t); for (int i = 0; i < t; i++) { p[i] = n - cnt[i]; } vector<tuple<int, int, int>> b; for (int i = 0; i < n; i++) { int sum = 0; for (int j = 0; j < t; j++) { if (a[i][j] == 1) { sum += p[j]; } } b.emplace_back(sum, accumulate(a[i].begin(), a[i].end(), 0), n - i); } sort(b.rbegin(), b.rend()); for (int i = 0; i < (int) b.size(); i++) { if (get<2>(b[i]) == n - id) { cout << get<0>(b[i]) << " " << i + 1 << '\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...