# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303016 | 2020-09-19T18:16:55 Z | bigg | Olympiads (BOI19_olympiads) | C++14 | 2000 ms | 34544 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 2044 KB | Output is correct |
2 | Correct | 51 ms | 2028 KB | Output is correct |
3 | Correct | 50 ms | 2044 KB | Output is correct |
4 | Correct | 49 ms | 2036 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 878 ms | 16980 KB | Output is correct |
2 | Correct | 828 ms | 16976 KB | Output is correct |
3 | Correct | 878 ms | 17124 KB | Output is correct |
4 | Correct | 823 ms | 16976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2025 ms | 34544 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 2044 KB | Output is correct |
2 | Correct | 51 ms | 2028 KB | Output is correct |
3 | Correct | 50 ms | 2044 KB | Output is correct |
4 | Correct | 49 ms | 2036 KB | Output is correct |
5 | Correct | 878 ms | 16980 KB | Output is correct |
6 | Correct | 828 ms | 16976 KB | Output is correct |
7 | Correct | 878 ms | 17124 KB | Output is correct |
8 | Correct | 823 ms | 16976 KB | Output is correct |
9 | Execution timed out | 2025 ms | 34544 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |