# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1011048 | feukic | Poi (IOI09_poi) | C++14 | 165 ms | 23892 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |