Submission #659774

#TimeUsernameProblemLanguageResultExecution timeMemory
659774ivopavPoi (IOI09_poi)C++14
100 / 100
668 ms8724 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int t;
    int p;
    cin >> n >> t >> p;
    vector<vector<bool>> mat={};
    vector<int> lis=vector<int>(t,0);
    for (int i=0;i<n;i++){
        mat.push_back({});
        for (int j=0;j<t;j++){
            bool unos;
            cin >> unos;
            mat[i].push_back(unos);
            lis[j]+=(int)(!unos);
        }
    }
   // cout << "-----------------\n";
    vector<pair<int,pair<int,int>>> lis2={};
    for (int i=0;i<n;i++){
        lis2.push_back({0,{0,i}});
        for (int j=0;j<t;j++){
            lis2[i].first-=lis[j]*(int)(mat[i][j]);
            lis2[i].second.first-=(int)(mat[i][j]);
        }
    }
    sort(lis2.begin(),lis2.end());
    for (int i=0;i<lis2.size();i++){
       // cout << lis2[i].first << " " << lis2[i].second.first << " " << lis2[i].second.second << "\n";
        if (lis2[i].second.second==p-1){
            cout << -lis2[i].first << " " << i+1 << "\n";
        }
    }
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i=0;i<lis2.size();i++){
      |                  ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...