Submission #583131

# Submission time Handle Problem Language Result Execution time Memory
583131 2022-06-24T21:28:50 Z evening_g Poi (IOI09_poi) C++11
0 / 100
266 ms 8736 KB
/**
 * @file poi.cpp
 * @brief https://oj.uz/problem/view/IOI09_poi
 * @version 0.1
 * @date 2022-06-24
 * 
 * 
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int find_rank(const vector<int> &v, const int &target) {
    int index = 0;
    while(v[index] != target) index++;
    return index + 1;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    // DEFINE VARIABLES

    int n, t, p;

    cin >> n >> t >> p;

    vector< vector<int> > contestants(n, {t, 0}); // tasks solved by each contestant
    vector<int> tasks(t, n);    // worth of each task
    vector<int> score(n, 0);    // score of each contestant

    // READ DATA

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < t; j++) {
            cin >> contestants[i][j];
            // if this user solved this task
            if (contestants[i][j] == 1) {
                // the worth of the task decreases with each contestant that solves it
                tasks[j] --;
            }
        }        
    }
    
    // PROCESS
    //calculate score of each contestant
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < t; j++) {
            if (contestants[i][j] == 1) {
                // the worth of the task decreases with each contestant that solves it
                score[i] += tasks[j];
            } 
        }
    }
    
    // get philip schore
    int philip_score = score[p + 1];

    // sort by score
    sort(score.begin(), score.end(), greater<int>());

    // as there can't be contestats with the same score
    // we use philip's score to find its rank

    cout << philip_score << " " << find_rank(score, philip_score) << '\n';
       
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Runtime error 1 ms 444 KB Execution killed with signal 6
3 Runtime error 1 ms 468 KB Execution killed with signal 6
4 Runtime error 1 ms 468 KB Execution killed with signal 6
5 Runtime error 1 ms 468 KB Execution killed with signal 6
6 Runtime error 1 ms 452 KB Execution killed with signal 6
7 Runtime error 1 ms 468 KB Execution killed with signal 6
8 Runtime error 1 ms 468 KB Execution killed with signal 6
9 Runtime error 2 ms 468 KB Execution killed with signal 6
10 Runtime error 3 ms 464 KB Execution killed with signal 6
11 Runtime error 10 ms 768 KB Execution killed with signal 6
12 Runtime error 15 ms 872 KB Execution killed with signal 6
13 Runtime error 37 ms 1624 KB Execution killed with signal 6
14 Runtime error 51 ms 2252 KB Execution killed with signal 6
15 Runtime error 92 ms 3432 KB Execution killed with signal 6
16 Runtime error 115 ms 3788 KB Execution killed with signal 6
17 Runtime error 156 ms 5260 KB Execution killed with signal 6
18 Runtime error 159 ms 5896 KB Execution killed with signal 6
19 Runtime error 221 ms 7716 KB Execution killed with signal 6
20 Runtime error 266 ms 8736 KB Execution killed with signal 6