Submission #433137

#TimeUsernameProblemLanguageResultExecution timeMemory
433137ioiPoi (IOI09_poi)C++14
100 / 100
761 ms23740 KiB
#include<bits/stdc++.h>
using namespace std;


struct con{

    int idx , numberofsolved , score ;



    bool operator < (const con & a)const {
        if(score != a.score)
            return score > a.score ;

        if(numberofsolved != a.numberofsolved)
            return numberofsolved > a.numberofsolved ;

        return idx < a.idx ;

    }

};

int main(){

    int n , t , p ;
    cin >> n >> t >> p ;
    p-- ;

    int points[t] = {} ;

    int arr[n][t];

    for(int i = 0 ; i <  n; i ++){


        for(int j = 0 ; j < t ; j ++){
            cin >> arr[i][j] ;


            if(arr[i][j] == 0)points[j] ++ ;
        }

    }

    deque<con> d ;

    for(int i = 0 ; i < n ; i ++){

        int sc = 0 , nos = 0 ;



        for(int j = 0 ; j < t ; j ++)
            sc += (arr[i][j] ? points[j] : 0) , nos += !!arr[i][j];

        d.push_back({i , nos , sc});

    }


    sort(d.begin() , d.end());
    for(int r = 0 ; r < d.size() ; r ++ ){

        if(d[r].idx == p){
            cout << d[r].score << " " << r + 1 << endl ;
            break;
        }
    }

}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:63:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<con>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |     for(int r = 0 ; r < d.size() ; r ++ ){
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...