제출 #933638

#제출 시각아이디문제언어결과실행 시간메모리
933638NeytrinoPoi (IOI09_poi)C++14
100 / 100
193 ms16220 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 ) return true; if( b.score > a.score ) return false; if( a.solved > b.solved ) return true; if( b.solved > a.solved ) return false; return a.ID < b.ID; }); 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...