# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299898 | 2020-09-16T01:25:58 Z | ly20 | Olympiads (BOI19_olympiads) | C++17 | 2000 ms | 17936 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 510; int n, k, c; int val[MAXN][MAXN]; vector <int> at; int mx[MAXN]; bool ok[MAXN]; void bk(int l, int a) { if(n - a < l) return; if(l == 0) { for(int i = 0; i < k; i++) { mx[i] = 0; } for(int i = 0; i < n; i++) { if(ok[i]) { //printf("%d ", i); for(int j = 0; j < k; j++) mx[j] = max(mx[j], val[i][j]); } } //printf("\n"); int resp = 0; for(int i = 0; i < k; i++) { resp += mx[i]; } at.push_back(resp); return; } if(a == n) return; ok[a] = 1; bk(l - 1, a + 1); ok[a] = 0; bk(l, a + 1); } bool cmp(int a, int b) { return a > b; } int main() { scanf("%d %d %d", &n, &k, &c); for(int i = 0; i < n; i++) { for(int j = 0; j < k; j++) { scanf("%d", &val[i][j]); mx[j] = max(mx[j], val[i][j]); } } bk(k, 0); sort(at.begin(), at.end(), cmp); printf("%d\n", at[c - 1]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 2040 KB | Output is correct |
2 | Correct | 88 ms | 2076 KB | Output is correct |
3 | Correct | 80 ms | 2040 KB | Output is correct |
4 | Correct | 80 ms | 2040 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 915 ms | 16976 KB | Output is correct |
2 | Correct | 895 ms | 17024 KB | Output is correct |
3 | Correct | 937 ms | 17076 KB | Output is correct |
4 | Correct | 910 ms | 17104 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2083 ms | 17936 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 2040 KB | Output is correct |
2 | Correct | 88 ms | 2076 KB | Output is correct |
3 | Correct | 80 ms | 2040 KB | Output is correct |
4 | Correct | 80 ms | 2040 KB | Output is correct |
5 | Correct | 915 ms | 16976 KB | Output is correct |
6 | Correct | 895 ms | 17024 KB | Output is correct |
7 | Correct | 937 ms | 17076 KB | Output is correct |
8 | Correct | 910 ms | 17104 KB | Output is correct |
9 | Execution timed out | 2083 ms | 17936 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |