Submission #531488

# Submission time Handle Problem Language Result Execution time Memory
531488 2022-02-28T21:42:12 Z sep Poi (IOI09_poi) C++14
5 / 100
594 ms 24152 KB
/******************************************************************************

                              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 < T; i++) {
        for (int j = 0; j < N; 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
1 Incorrect 1 ms 260 KB Output isn't correct
2 Runtime error 1 ms 332 KB Execution killed with signal 11
3 Runtime error 1 ms 296 KB Execution killed with signal 11
4 Incorrect 1 ms 204 KB Output isn't correct
5 Runtime error 1 ms 384 KB Execution killed with signal 11
6 Incorrect 1 ms 204 KB Output isn't correct
7 Runtime error 2 ms 424 KB Execution killed with signal 11
8 Incorrect 2 ms 332 KB Output isn't correct
9 Runtime error 4 ms 460 KB Execution killed with signal 11
10 Incorrect 5 ms 476 KB Output isn't correct
11 Runtime error 18 ms 1500 KB Execution killed with signal 11
12 Incorrect 39 ms 1452 KB Output isn't correct
13 Runtime error 118 ms 6280 KB Execution killed with signal 11
14 Incorrect 132 ms 5420 KB Output isn't correct
15 Runtime error 250 ms 15268 KB Execution killed with signal 11
16 Incorrect 238 ms 9872 KB Output isn't correct
17 Runtime error 361 ms 24152 KB Execution killed with signal 11
18 Incorrect 436 ms 16240 KB Output isn't correct
19 Incorrect 553 ms 21492 KB Output isn't correct
20 Correct 594 ms 23824 KB Output is correct