답안 #854521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
854521 2023-09-27T19:47:34 Z tvladm2009 Olympiads (BOI19_olympiads) C++17
44 / 100
2000 ms 133688 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N = 500 + 7;
const int K = 10;
int score[N][K];
int n, k, c;
vector<int> team, v;

void rec(int cnt = 1) {
  if (cnt == k + 1) {
    vector<int> total(k + 1, 0);
    for (auto &i : team) {
      for (int j = 1; j <= k; j++) {
        total[j] = max(total[j], score[i][j]);
      }
    }
    int now = 0;
    for (int j = 1; j <= k; j++) {
      now += total[j];
    }
    v.push_back(now);
    return;
  }
  int start = (team.empty() ? 1 : team.back() + 1);
  for (int i = start; i <= n; i++) {
    team.push_back(i);
    rec(cnt + 1);
    team.pop_back();
  }
}

signed main() {
#ifdef ONPC
  freopen ("input.txt", "r", stdin);
#else
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif // ONPC

  cin >> n >> k >> c;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      cin >> score[i][j];
    }
  }
  rec();
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  cout << v[c - 1] << "\n";
  return 0;
}
/**

dp[i][mxa][mxb] = ?

**/
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 992 KB Output is correct
2 Correct 9 ms 988 KB Output is correct
3 Correct 9 ms 992 KB Output is correct
4 Correct 5 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 575 ms 18356 KB Output is correct
2 Correct 553 ms 18960 KB Output is correct
3 Correct 609 ms 18904 KB Output is correct
4 Correct 574 ms 17080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2009 ms 133688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 992 KB Output is correct
2 Correct 9 ms 988 KB Output is correct
3 Correct 9 ms 992 KB Output is correct
4 Correct 5 ms 992 KB Output is correct
5 Correct 575 ms 18356 KB Output is correct
6 Correct 553 ms 18960 KB Output is correct
7 Correct 609 ms 18904 KB Output is correct
8 Correct 574 ms 17080 KB Output is correct
9 Execution timed out 2009 ms 133688 KB Time limit exceeded
10 Halted 0 ms 0 KB -