Submission #251016

#TimeUsernameProblemLanguageResultExecution timeMemory
25101679bruePoi (IOI09_poi)C++14
100 / 100
411 ms12152 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
int n, p, k;
 
bool solved[2002][2002];
 
int points[2002];
int score[2002];
int cnt[2002];
 
int ans;
 
int main(){
    scanf("%d %d %d", &n, &p, &k);
    for(int i=1; i<=n; i++){
        for(int j=1; j<=p; j++){
            scanf("%d", &solved[i][j]);
            if(!solved[i][j]) points[j]++;
            else cnt[i]++;
        }
    }
 
    for(int i=1; i<=n; i++){
        for(int j=1; j<=p; j++){
            if(solved[i][j]) score[i] += points[j];
        }
    }
 
//    for(int i=1; i<=p; i++)
//        printf("%d problem point: %d\n", i, points[i]);
 
    for(int i=1; i<=n; i++){
//        printf("%d\'s score: %d\n", i, score[i]);
        if(score[k] < score[i]) ans++;
        else if(score[k] == score[i]){
            if(cnt[k] < cnt[i]) ans++;
            else if(cnt[k] == cnt[i] && i<k) ans++;
        }
    }
 
    printf("%d %d", score[k], ans+1);
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:19:38: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'bool*' [-Wformat=]
             scanf("%d", &solved[i][j]);
                         ~~~~~~~~~~~~~^
poi.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &p, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:19: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...