제출 #670733

#제출 시각아이디문제언어결과실행 시간메모리
670733vjudge1Poi (IOI09_poi)C++17
100 / 100
201 ms9616 KiB
// https://oj.uz/problem/view/IOI09_poi?locale=en #include <iostream> #include <algorithm> #include <vector> using namespace std; struct Contestant { int id, tasks_solved = 0, score = 0; vector<int> number_of_task; }; bool operator<(const Contestant &a, const Contestant &b) { if (a.score > b.score) return true; else { if (a.score < b.score) return false; else { if (a.tasks_solved > b.tasks_solved) return true; else { if (a.tasks_solved < b.tasks_solved) return false; else { if (a.id < b.id) return true; else return false; } } } } }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, t, p; cin >> n >> t >> p; vector<int> points_by_task(t + 1); points_by_task.assign(points_by_task.size(), 0); vector<Contestant> contestants(n); for (int i = 0; i < n; i++) { contestants[i].id = i + 1; for (int j = 0; j < t; j++) { int x; cin >> x; if (x == 0) { points_by_task[j + 1]++; } else { contestants[i].tasks_solved++; contestants[i].number_of_task.push_back(j + 1); } } } for (Contestant& c : contestants) { for (const int& num : c.number_of_task) c.score += points_by_task[num]; } sort(contestants.begin(), contestants.end()); for (int i = 0; i < n; i++) { if (contestants[i].id == p) { cout << contestants[i].score << " " << i + 1; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...