Submission #303016

#TimeUsernameProblemLanguageResultExecution timeMemory
303016biggOlympiads (BOI19_olympiads)C++14
44 / 100
2025 ms34544 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 510; std::vector<int> allteams; bool marc[MAXN]; int scores[MAXN][MAXN]; //score do i-esimo cara no j-esimo esporte; int maxnesse[MAXN]; int n, k; void backtrack(int numteam, int id){ if(numteam == k){ int soma = 0; for(int i = 1; i <= k; i++){ maxnesse[i] = 0; } for(int i = 1; i <= n; i++){ if(!marc[i]) continue; for(int j = 1; j <= k; j++){ if(scores[i][j] > maxnesse[j]){ soma += scores[i][j] - maxnesse[j]; maxnesse[j] = scores[i][j]; } } } allteams.push_back(-soma); return; } if(id == n + 1) return; marc[id] = 1; backtrack(numteam + 1, id + 1); marc[id] = 0; backtrack(numteam, id + 1); } int c; int main(){ scanf("%d %d %d", &n, &k, &c); for(int i = 1; i <= n; i++){ for(int j = 1; j <= k; j++){ scanf("%d", &scores[i][j]); } } backtrack(0, 1); sort(allteams.begin(), allteams.end()); printf("%d\n", -allteams[c-1] ); }

Compilation message (stderr)

olympiads.cpp: In function 'int main()':
olympiads.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |  scanf("%d %d %d", &n, &k, &c);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:38:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |    scanf("%d", &scores[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...