제출 #1011050

#제출 시각아이디문제언어결과실행 시간메모리
1011050feukicPoi (IOI09_poi)C++14
100 / 100
168 ms16200 KiB
#include <iostream> #include <vector> #include <string> #include <utility> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <cmath> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n, t, p; cin >> n >> t >> p; vector<int> scores(t); vector<vector<int>> arr(n, vector<int>(t)); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { cin >> arr[i][j]; if (!arr[i][j]) { scores[j]++; } } } vector<vector<int>> results(n, vector<int>(3)); for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { results[i][0] += arr[i][j] ? scores[j] : 0; results[i][1] += arr[i][j]; results[i][2] = i + 1; } } sort(results.begin(), results.end(), [](vector<int> a, vector<int> b) { if (a[0] == b[0]) { if (a[1] == b[1]) { return a[2] < b[2]; } else { return a[1] > b[1]; } } return a[0] > b[0]; }); for (int i = 0; i < n; i++) { if (results[i][2] == p) { cout << results[i][0] << " " << i + 1 << endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...