제출 #761777

#제출 시각아이디문제언어결과실행 시간메모리
761777BlagojPoi (IOI09_poi)C++17
100 / 100
211 ms23756 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() struct T { int score, tasks, id; }; bool csort(T a, T b) { if (a.score != b.score) return a.score > b.score; if (a.tasks != b.tasks) return a.tasks > b.tasks; return a.id < b.id; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, t, p; cin >> n >> t >> p; --p; int val[t], solve[n][t]; memset(val, 0, sizeof(val)); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { cin >> solve[i][j]; val[j] += (solve[i][j] == 0); } } vector<T> v; for (int i = 0; i < n; i++) { int sum = 0, tasks = 0; for (int j = 0; j < t; j++) { if (solve[i][j] == 1) { tasks++; sum += val[j]; } } v.push_back({sum, tasks, i}); } sort(all(v), csort); for (int i = 0; i < n; i++) { if (v[i].id == p) { cout << v[i].score << " " << i + 1; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...