Submission #571405

#TimeUsernameProblemLanguageResultExecution timeMemory
571405amukkalirPoi (IOI09_poi)C++17
100 / 100
349 ms12048 KiB
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std; 

const int nax = 2000; 
int pt[nax+5]; 

signed main () {
    int n, t, p; 
    scanf("%d %d %d", &n, &t, &p); 
    
    bool sc[n][t]; 
    for(int i=0; i<n; i++) {
        for(int j=0; j<t; j++) {
            int x; scanf("%d", &x); 
            pt[j] += (x==0); 
            sc[i][j] = x; 
        }
    }

    //point, task, id 
    vector<pair<pair<int,int>, int>> ans; 
    for(int i=0; i<n; i++) {
        int point = 0, task = 0, id = i+1; 
        for(int j=0; j<t; j++) {
            task += sc[i][j]; 
            if(sc[i][j]) point += pt[j]; 
        }
        //cout << id << " " << point << endl; 
        ans.push_back({{-point, -task}, id}); 
    }

    sort(ans.begin(), ans.end()); 
    for(int i=0; i<n; i++) {
        //cout << ans[i].first.first*-1 << " " << ans[i].first.second*-1 << ' ' << ans[i].second << endl; 
        if(ans[i].second == p) {
            printf("%d %d", ans[i].first.first * -1, i+1); 
            return 0; 
        }
    }
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %d %d", &n, &t, &p);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:16:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             int x; scanf("%d", &x);
      |                    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...