Submission #526102

#TimeUsernameProblemLanguageResultExecution timeMemory
526102DeepessonPoi (IOI09_poi)C++17
100 / 100
543 ms15936 KiB
#include <bits/stdc++.h> typedef std::pair<int,int> pii; typedef std::pair<pii,int> ppi; bool sortar(ppi a,ppi b){ if(a.first.first!=b.first.first){ return a>b; }else { if(a.first.second!=b.first.second){ return a>b; }else return a<b; } } int main() { int N,T,P; std::cin>>N>>T>>P; int pontos[T]={}; int resolveu[N]={}; int tab[N][T]; for(int i=0;i!=N;++i){ for(int j=0;j!=T;++j){ int x; std::cin>>x; tab[i][j]=x; if(!x)pontos[j]++;else resolveu[i]++; } } int score[N]={}; for(int i=0;i!=N;++i){ for(int j=0;j!=T;++j){ if(tab[i][j])score[i]+=pontos[j]; } } std::cout<<score[P-1]<<" "; std::vector<ppi> geral; for(int i=0;i!=N;++i){ geral.push_back({{score[i],resolveu[i]},i}); } std::sort(geral.begin(),geral.end(),sortar); for(int i=0;i!=geral.size();++i){ if(geral[i].second==P-1){ std::cout<<(i+1)<<"\n"; return 0; } } }

Compilation message (stderr)

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