Submission #495536

#TimeUsernameProblemLanguageResultExecution timeMemory
495536PiejanVDCPoi (IOI09_poi)C++17
5 / 100
554 ms8696 KiB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    int n,t,p; cin>>n>>t>>p;
    vector<int>v(t,n);
    vector<vector<bool>>l(n,vector<bool>(t));
    for(int i = 0 ; i < n ; i++) {
        for(int j = 0 ; j < t ; j++) {
            int x; cin>>x;
            if(x) l[i][j] = 1;
            if(l[i][j]) v[j]--;
        }
    }
    vector<pair<int,int>>scores;
    for(int i = 0 ; i < n ; i++) {
        int score = 0;
        for(int j = 0 ; j < t ; j++) {
            if(l[i][j]) score += v[j];
        }
        scores.push_back({score,i});
    }
    p--;
    sort(scores.begin(),scores.end());
    for(int i = 0 ; i < n ; i++) {
        if(scores[i].second == p) {
            cout << scores[i].first << " " << ++i;
            return 0;
        }
    }
    assert(0);
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:27:47: warning: operation on 'i' may be undefined [-Wsequence-point]
   27 |             cout << scores[i].first << " " << ++i;
      |                                               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...