Submission #1080411

#TimeUsernameProblemLanguageResultExecution timeMemory
1080411vjudge1Poi (IOI09_poi)C++17
5 / 100
438 ms23980 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct part { int id; int sc; int sv; }; bool comp(const part&a, const part&b) { if (a.sc != b.sc) return a.sc > b.sc; if (a.sv != b.sv) return a.sc > b.sc; return a.id < b.id; } int main() { int n, t, p; cin >> n >> t >> p; vector<vector<int>> v(n, vector<int>(t)); vector<int> sum(t, 0); vector<part> pr(n); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { cin >> v[i][j]; } } for (int j = 0; j < t; j++) { for (int i = 0; i < n; i++) { if (v[i][j] == 0) sum[j]++; } } for (int i = 0; i < n; i++) { pr[i].id = i + 1; pr[i].sc = 0; pr[i].sv = 0; for (int j = 0; j < t; j++) { if (v[i][j] == 1) { pr[i].sc += sum[j]; pr[i].sv++; } } } sort(pr.begin(), pr.end(), comp); int fsc = pr[p-1].sc; int rank = 1; for (int i = 0; i < n; i++) { if (pr[i].id == p) { rank = i + 1; break; } } cout << fsc << ' ' << rank; }
#Verdict Execution timeMemoryGrader output
Fetching results...