Submission #717744

#TimeUsernameProblemLanguageResultExecution timeMemory
717744AndrijaMPoi (IOI09_poi)C++14
55 / 100
582 ms32576 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long n,t,p; cin>>n>>t>>p; long long cpt[t]={0}; vector<long long>v[n]; long long val[n]; int ts[n]={0}; memset(val,0,sizeof val); vector<pair<long long,long long>>r; for(long long i=0;i<n;i++) { for(long long j=0;j<t;j++) { long long num; cin>>num; v[i].push_back(num); ts[i]+=num; cpt[j]+=num;///lugje-cpt[j] treba } } for(long long i=0;i<n;i++) { for(long long j=0;j<t;j++) { if(v[i][j]==1) val[i]+=n-cpt[j]; } r.push_back({val[i],i+1}); } sort(r.rbegin(),r.rend()); vector<pair<long long,long long>>ans; vector<array<int,3>>a; bool ok=true; long long pos; for(long long i=0;i<r.size();i++) { if(r[i].first==val[p-1]) { a.push_back({r[i].first, ts[r[i].second-1],r[i].second}); if(ok) { pos=i+1; ok=false; } } } sort(a.rbegin(),a.rend()); ///Odavde treba da se uzmu t ikoj imaju isto zadataka reseno i da se gurnu u ans; ///ans.push_back({r[i].first, r[i].second}); sort(ans.begin(),ans.end()); for(long long i=0;i<ans.size();i++) { if(ans[i].second==p-1) { pos+=i+1; } } cout<<val[p-1]<<" "<<pos<<endl; return 0; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:40:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(long long i=0;i<r.size();i++)
      |                       ~^~~~~~~~~
poi.cpp:44:31: warning: narrowing conversion of 'r.std::vector<std::pair<long long int, long long int> >::operator[](((std::vector<std::pair<long long int, long long int> >::size_type)i)).std::pair<long long int, long long int>::first' from 'long long int' to 'int' [-Wnarrowing]
   44 |             a.push_back({r[i].first, ts[r[i].second-1],r[i].second});
poi.cpp:44:61: warning: narrowing conversion of 'r.std::vector<std::pair<long long int, long long int> >::operator[](((std::vector<std::pair<long long int, long long int> >::size_type)i)).std::pair<long long int, long long int>::second' from 'long long int' to 'int' [-Wnarrowing]
   44 |             a.push_back({r[i].first, ts[r[i].second-1],r[i].second});
poi.cpp:56:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |     for(long long i=0;i<ans.size();i++)
      |                       ~^~~~~~~~~~~
poi.cpp:60:16: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   60 |             pos+=i+1;
      |             ~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...