# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
531489 | sep | Poi (IOI09_poi) | C++14 | 575 ms | 16036 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.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> points, solutionsPerProblem, problemsSolved;
bool comp(int i, int j) {
if (points[i] > points[j]) return true;
else if (points[i] < points[j]) return false;
else if (problemsSolved[i] > problemsSolved[j]) return true;
else if (problemsSolved[i] < problemsSolved[j]) return false;
return i < j;
}
void sortPlayers(vector<vector<int>> & table, vector<int> & players) {
int T = (int) table[0].size(), N = (int) players.size();
for (int i = 0; i < T; i++) {
for (int j = 0; j < N; j++) solutionsPerProblem[i] += table[j][i];
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < T; j++) {
if (table[i][j]) {
points[i] += (N - solutionsPerProblem[j]);
problemsSolved[i]++;
}
}
}
sort(players.begin(), players.end(), comp);
}
int main()
{
int N, T, P;
cin >> N >> T >> P;
vector<vector<int>> table (N, vector<int>(T));
vector<int> players(N);
points.assign(N, 0);
problemsSolved.assign(N, 0);
solutionsPerProblem.assign(T, 0);
for (int i = 0; i < N; i++) {
players[i] = i;
for (int j = 0; j < T; j++) {
cin >> table[i][j];
}
}
sortPlayers(table, players);
for (int i = 0; i < N; i++) {
if (players[i] == P-1) {
cout << points[P-1] << " " << i + 1 << "\n";
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |