Submission #646263

#TimeUsernameProblemLanguageResultExecution timeMemory
646263berrOlympiads (BOI19_olympiads)C++17
13 / 100
282 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k, c; cin>>n>>k>>c; vector<vector<int>> a[k+1]; vector<vector<int>> b(n, vector<int>(k)); for(int i=0; i<n; i++) { for(int l=0; l<k; l++) { cin>>b[i][l]; } } for(int i=0; i<n; i++) { for(int l=k-1; l>=1; l--) { for(auto p: a[l]) { vector<int> s=p; for(int j=0; j<k; j++) s[j]=max(s[j], b[i][j]); a[l+1].push_back(s); } } a[1].push_back(b[i]); } vector<int> ans; for(int i=0; i<a[k].size(); i++) { int s=0; for(auto l: a[k][i]) { s+=l; } ans.push_back(s); } sort(ans.begin(), ans.end(), greater<int>()); cout<<ans[c-1]; }

Compilation message (stderr)

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