Submission #866276

#TimeUsernameProblemLanguageResultExecution timeMemory
866276BulaPoi (IOI09_poi)C++14
100 / 100
497 ms23888 KiB
#include <bits/stdc++.h>
using namespace std;


main(){
    int n, m, p;
    cin >> n >> m >> p;
    int x[n + 1][m + 1];
    vector<int> a(m + 1);
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> x[i][j];
        }
    }

    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= n; j++){
            a[i] += (1 - x[j][i]);
        }
    }
    int sc = 0, pr = 0;
    for(int i = 1; i <= m; i++){
        if(x[p][i] == 1){
            sc += a[i];
            pr++;
        }
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        int cur = 0, prob = 0;
        for(int j = 1; j <= m; j++){
            if(x[i][j] == 1){
                cur += a[j];
                prob++;
            }
        }
        if(sc < cur){
            cnt++;
        }else if(sc == cur){
            if(prob > pr) cnt++;
            else if(prob == pr){
                if(p > i) cnt++;
            }
        }
    }
    cout << sc << " " << cnt + 1 << endl;
}

Compilation message (stderr)

poi.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...