제출 #863778

#제출 시각아이디문제언어결과실행 시간메모리
863778Trisanu_DasOlympiads (BOI19_olympiads)C++17
44 / 100
2073 ms133524 KiB
#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) 메시지

olympiads.cpp: In function 'int main()':
olympiads.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |  scanf("%d %d %d", &n, &k, &c);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:37:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |    scanf("%d", &a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...