| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 472807 | dron_rp | Poi (IOI09_poi) | C++14 | 342 ms | 24196 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;
using ll = long long;
struct Participant{
    int id, tasks, points;
    vector<int> scores;
};
void getScoreProblems(int n, int t, vector<int>& problems, vector<Participant>& participants){
    int x;
    for (int i = 0; i<n; i++){
        participants[i].id = i+1;
        int sum = 0;
        for (int j = 0; j<t; j++){
            cin >> x;
            if (x == 0){
                problems[j]++;
            } else {
                sum++;
            }
            participants[i].scores.push_back(x);
        }
        participants[i].tasks = sum;
        participants[i].points = 0;
    }
}
bool comp(Participant& a, Participant& b){
    if (a.points != b.points){
        return a.points >= b.points;
    }
    if (a.tasks != b.tasks){
        return a.tasks >= b.tasks;
    }
    return a.id <= b.id;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, t, p;
    cin >> n >> t >> p;
    vector<int> problems(t, 0);
    vector<Participant> participants(n);
    getScoreProblems(n, t, problems, participants);
    
    for (int i = 0; i<n; i++){
        int sum = 0;
        for (int j = 0; j<t; j++){
            if (participants[i].scores[j] != 0) sum += problems[j];
        }
        participants[i].points = sum;
    }
    sort(participants.begin(), participants.end(), comp);
    for (int i = 0; i<n; i++){
        if (participants[i].id == p){
            cout << participants[i].points << " " << i+1 << "\n";
            break;
        }
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
