Submission #230373

#TimeUsernameProblemLanguageResultExecution timeMemory
230373CaroLindaPoi (IOI09_poi)C++14
100 / 100
417 ms17784 KiB
#include <bits/stdc++.h>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define mkt make_tuple
#define debug printf
#define all(x) x.begin(),x.end()
#define lp(i,a,b) for(int i = a ; i< b ; i++)
#define ss second
#define ff first
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mk make_pair

using namespace std ;

struct Contestant
{
    int score, solved, id ;

    Contestant() { score = solved = id = 0 ; }

    bool operator < ( Contestant other ) const
    {
        if( score == other.score && solved == other.solved ) return id < other.id ;
        if(score == other.score ) return solved > other.solved ;
        return score > other.score ;
    }

};

int N , T , P ;
int score_task[2010] , solved[2010][2010 ] ;
Contestant v[2010] ;

int main()
{
    scanf("%d%d%d", &N, &T , &P ) ;
    lp(i,1,N+1)
    {
        for(int j = 1 ; j <= T ; j++ )
        {
            scanf("%d", &solved[i][j] ) ;
            v[i].solved += solved[i][j] ;
            score_task[j] += !solved[i][j] ;
        }
        v[i].id = i ;
    }

    lp(i,1,N+1)
        lp(j,1,T+1) v[i].score += solved[i][j] * score_task[j] ;

    sort( v+1, v+1+N ) ;

    lp(i,1,N+1)
        if( v[i].id == P )
            printf("%d %d\n" , v[i].score, i ) ;
}

Compilation message (stderr)

poi.cpp:4:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("O3")
 
poi.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
 
poi.cpp: In function 'int main()':
poi.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &N, &T , &P ) ;
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:46:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &solved[i][j] ) ;
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...