제출 #146826

#제출 시각아이디문제언어결과실행 시간메모리
146826VlatkoOlympiads (BOI19_olympiads)C++14
44 / 100
2033 ms131912 KiB
#include <bits/stdc++.h> using namespace std; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifndef ONLINE_JUDGE #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else #define debug(x...) #endif typedef long long ll; typedef pair<int, int> pii; const int maxn = 500; const int maxk = 6; int n, k, c; int p[maxn][maxk]; vector<int> scores; // vector<pair<int, vector<int>>> teams; vector<int> team; int getscore(vector<int> &team) { int score = 0; for (int i = 0; i < k; ++i) { int res = 0; for (int j = 0; j < k; ++j) { res = max(res, p[team[j]][i]); } score += res; } return score; } void gen(int i, int num) { if (num == k) { // teams.emplace_back(getscore(team), team); scores.push_back(getscore(team)); } else if (i == n) { return; } else { gen(i+1, num); team.push_back(i); gen(i+1, num+1); team.pop_back(); } } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k >> c; for (int i = 0; i < n; ++i) { for (int j = 0; j < k; ++j) { cin >> p[i][j]; } } gen(0, 0); sort(scores.begin(), scores.end(), greater<int>()); cout << scores[c-1] << endl; // for (int i = 0; i < (int)scores.size(); ++i) { // debug(i, scores[i]); // } // sort(teams.rbegin(), teams.rend()); // team.resize(k); // int i = 0; // for (auto &p : teams) { // int score = p.first; // int diff = 0; // for (int i = 0; i < k; ++i) { // if (team[i] != p.second[i]) { // ++diff; // } // team[i] = p.second[i]; // } // debug(i, score, team, diff); // ++i; // } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...