Submission #933637

#TimeUsernameProblemLanguageResultExecution timeMemory
933637NeytrinoPoi (IOI09_poi)C++14
0 / 100
187 ms16216 KiB
/** * author: inastranets * created: 26.02.2024 06:14:03 **/ #include <bits/stdc++.h> using namespace std; //#if !defined(ONLINE_JUDGE) //#include "debug.hpp" //#endif const int UNDEF = -1; class contestant { public: int score; int solved; int ID; //contestant(int _score, int _solved, int _ID) : score(_score), solved(_solved), ID(_ID) {} }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, t, p; cin >> n >> t >> p; vector<contestant> a(n); vector<int> point_of_tasks(t); vector<vector<int> > solved(n, vector<int>(t, 0)); for (int i = 0; i < n; ++ i) { for (int j = 0; j < t; ++ j) { cin >> solved[i][j]; point_of_tasks[j] += (solved[i][j] == 0); } } for (int i = 0; i < n; ++ i) { a[i].ID = i + 1; for (int j = 0; j < t; ++ j) { if (solved[i][j]) { ++ a[i].solved; a[i].score += point_of_tasks[j]; } } } sort(a.begin(), a.end(), [](const contestant& a, const contestant& b) { if (a.score == b.score) { if (a.solved == b.solved) { return a.ID < b.ID; } else { return a.solved < b.solved; } } else { return a.score < b.score; } }); for (int i = 0; i < n; ++ i) { if (a[i].ID == p) { cout << a[i].score << ' ' << i + 1; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...