# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231695 | AlexLuchianov | Poi (IOI09_poi) | C++14 | 260 ms | 23800 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 <algorithm>
#include <vector>
using namespace std;
using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int const nmax = 2000;
int v[1 + nmax][1 + nmax];
int score[1 + nmax];
struct Person{
int id;
int score;
int problems;
bool operator < (Person const &a) const {
if(score != a.score)
return score > a.score;
else if(problems != a.problems)
return problems > a.problems;
else
return id < a.id;
}
} lst[1 + nmax];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, k, p;
cin >> n >> k >> p;
for(int i = 1; i <= k; i++)
score[i] = n;
for(int i = 1; i <= n; i++)
for(int j = 1;j <= k; j++) {
cin >> v[i][j];
score[j] -= v[i][j];
}
for(int i = 1;i <= n; i++){
lst[i] = {i, 0, 0};
for(int j = 1;j <= k; j++) {
lst[i].problems += v[i][j];
lst[i].score += score[j] * v[i][j];
}
}
sort(lst + 1, lst + n + 1);
for(int i = 1;i <= n; i++)
if(lst[i].id == p){
cout << lst[i].score << " " << i << '\n';
return 0;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |