답안 #586970

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
586970 2022-07-01T06:58:17 Z 박상훈(#8395) Olympiads (BOI19_olympiads) C++17
44 / 100
2000 ms 392 KB
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
priority_queue<int, vector<int>, greater<int>> pq;
int n, k, C, b[505][6];

void f(int i, int c, vector<int> a){
    if (c==k){
        int S = 0;
        for (auto &x:a) S += x;
        pq.push(S);
        if ((int)pq.size()>C) pq.pop();
        return;
    }
    if (i==n+1) return;

    f(i+1, c, a);
    for (int j=0;j<k;j++) a[j] = max(a[j], b[i][j]);
    f(i+1, c+1, a);
}

int main(){
    scanf("%d %d %d", &n, &k, &C);
    for (int i=1;i<=n;i++){
        for (int j=0;j<k;j++) scanf("%d", b[i]+j);
    }

    f(1, 0, vector<int>(k, 0));
    printf("%d\n", pq.top());
    return 0;
}

Compilation message

olympiads.cpp: In function 'int main()':
olympiads.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d %d %d", &n, &k, &C);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:26:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         for (int j=0;j<k;j++) scanf("%d", b[i]+j);
      |                               ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 340 KB Output is correct
2 Correct 16 ms 392 KB Output is correct
3 Correct 15 ms 392 KB Output is correct
4 Correct 10 ms 392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 411 ms 296 KB Output is correct
2 Correct 447 ms 292 KB Output is correct
3 Correct 422 ms 296 KB Output is correct
4 Correct 420 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2055 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 340 KB Output is correct
2 Correct 16 ms 392 KB Output is correct
3 Correct 15 ms 392 KB Output is correct
4 Correct 10 ms 392 KB Output is correct
5 Correct 411 ms 296 KB Output is correct
6 Correct 447 ms 292 KB Output is correct
7 Correct 422 ms 296 KB Output is correct
8 Correct 420 ms 292 KB Output is correct
9 Execution timed out 2055 ms 340 KB Time limit exceeded
10 Halted 0 ms 0 KB -