이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int scores[507][6];
int n, k, c;
vector<int> res;
void recur(int x, int remain, vector<int> cur){
if (x == n){
if (remain == 0){
int lol = 0;
for (int y = 0; y < k; y++) lol += cur[y];
res.push_back(lol);
}
return;
}
recur(x+1, remain, cur);
if (remain != 0){
for (int y = 0; y < k; y++){
cur[y] = max(cur[y], scores[x][y]);
}
recur(x+1, remain-1, cur);
}
}
main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> k >> c;
for (int x = 0; x < n; x++){
for (int y = 0; y < k; y++){
cin >> scores[x][y];
}
}
vector<int> init;
for (int x = 0; x < k; x++){
init.push_back(LLONG_MIN/20);
}
recur(0, k, init);
sort(res.begin(), res.end(), greater<int>());
cout << res[c-1];
}
컴파일 시 표준 에러 (stderr) 메시지
olympiads.cpp:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
35 | main(){
| ^~~~
# | 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... |