# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078387 | sqrteipi | Poi (IOI09_poi) | C++14 | 370 ms | 23888 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 <bits/stdc++.h>
using namespace std;
int cnt[2000];
bool cmp(pair<int, pair<int, int>> p1, pair<int, pair<int, int>> p2) {
if (p1.first==p2.first&&p1.second.first==p2.second.first) return p1.second.second < p2.second.second;
else if (p1.first==p2.first) return p1.second.first > p2.second.first;
return p1.first > p2.first;
}
int main() {
int n, t, p;
cin >> n >> t >> p;
int arr[n][t];
for (int i=0; i<t; i++) cnt[i] = n;
for (int i=0; i<n; i++) for (int j=0; j<t; j++) cin >> arr[i][j], cnt[j] -= arr[i][j];
vector<pair<int, pair<int, int>>> vec;
for (int i=0; i<n; i++) {
int score = 0, ac_count = 0;
for (int j=0; j<t; j++) score += cnt[j] * arr[i][j], ac_count += arr[i][j];
vec.push_back({score, {ac_count, i+1}});
}
sort(vec.begin(), vec.end(), cmp);
for (int i=0; i<n; i++) {
if (vec[i].second.second==p) {
cout << vec[i].first << " " << i+1 << "\n";
return 0;
}
// cout << vec[i].first << " " << vec[i].second.first << " " << vec[i].second.second << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |