Submission #485452

# Submission time Handle Problem Language Result Execution time Memory
485452 2021-11-07T22:21:08 Z asij123 Poi (IOI09_poi) C++14
60 / 100
149 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int n; int t; int p;



struct Contestant{
    int ID;

    int numSolved=0; int score=0; 

    int problemSet[INT16_MAX]= {0};


 };

 bool comp(Contestant one, Contestant two){

    if(one.score== two.score){
        if(one.numSolved==two.numSolved){
            return one.ID > two.ID;
        }
        return one.numSolved< two.numSolved;
    }

    return one.score < two.score;
}

 int main(){
     cin >> n; cin >> t; cin >> p;

     Contestant arr [n];

     for(int i=1; i<= n; i++){
         Contestant& con= arr[i-1];
         con.ID= i;

         for(int j=0; j<t; j++){
             
             int ans; cin >>ans;
            
             con.problemSet[j]= ans;

             if(ans == 1){
                 con.numSolved++;
             }
        }
     }



     for(int i=0; i< t; i++){
        int points=0;

        for(Contestant& a: arr){
            if(a.problemSet[i]==0) points++;
        }


        for(Contestant& a: arr){
            if(a.problemSet[i]==1) a.score+=points;
           
        }
     }

     sort(arr, arr+n, comp);


     for(int i=0; i< n; i++){
         if(arr[i].ID== p){
             cout << arr[i].score << " " << (n-i);
         }
     }
     





     




 }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1740 KB Output is correct
3 Correct 1 ms 2088 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 4 ms 4556 KB Output is correct
6 Correct 8 ms 7200 KB Output is correct
7 Correct 13 ms 9788 KB Output is correct
8 Correct 20 ms 11064 KB Output is correct
9 Correct 21 ms 13656 KB Output is correct
10 Correct 47 ms 26428 KB Output is correct
11 Correct 88 ms 39584 KB Output is correct
12 Correct 149 ms 65220 KB Output is correct
13 Runtime error 34 ms 65536 KB Execution killed with signal 9
14 Runtime error 34 ms 65540 KB Execution killed with signal 9
15 Runtime error 31 ms 65540 KB Execution killed with signal 9
16 Runtime error 31 ms 65540 KB Execution killed with signal 9
17 Runtime error 31 ms 65540 KB Execution killed with signal 9
18 Runtime error 31 ms 65540 KB Execution killed with signal 9
19 Runtime error 32 ms 65540 KB Execution killed with signal 9
20 Runtime error 34 ms 65540 KB Execution killed with signal 9