# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
863778 | Trisanu_Das | Olympiads (BOI19_olympiads) | C++17 | 2073 ms | 133524 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 510, maxk = 10;
int n, k, c;
int a[maxn][maxk];
vector<int> tot;
int get(vector<int> vt) {
static int aq[maxk];
memset(aq, 0, sizeof aq);
for(int x : vt) {
for(int j = 0; j < k; j++)
aq[j] = max(aq[j], a[x][j]);
}
int ans = 0;
for(int j = 0; j < k; j++)
ans += aq[j];
return ans;
}
void create(int id, vector<int> a) {
if(id == k) return (void)(tot.push_back(get(a)));
for(int j = a.back()+1; j < n; j++) {
a.push_back(j);
create(id+1, a);
a.pop_back();
}
}
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", &a[i][j]);
for(int i = 0; i < n; i++)
create(1, {i});
sort(tot.begin(), tot.end(), greater<int>());
printf("%d\n", tot[c-1]);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |