제출 #303014

#제출 시각아이디문제언어결과실행 시간메모리
303014biggOlympiads (BOI19_olympiads)C++14
0 / 100
2072 ms34424 KiB
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 510;
std::vector<int> allteams;
bool marc[MAXN];
int scores[MAXN][MAXN]; //score do i-esimo cara no j-esimo esporte;
int maxnesse[MAXN];
int n, k;
void backtrack(int numteam, int id){
	if(numteam == k){
		int soma = 0;
		for(int i = 1; i <= k; i++){
			maxnesse[i] = 0;
		}
		for(int i = 1; i <= n; i++){
			if(!marc[i]) continue;
			for(int j = 1; j <= k; j++){
				if(scores[i][j] > maxnesse[j]){
					soma += scores[i][j] - maxnesse[j];
					maxnesse[j] = scores[i][j];
				}
			}
		}
		allteams.push_back(soma);
		return;
	}
	if(id == n + 1) return;
	marc[id] = 1;
	backtrack(numteam + 1, id + 1);
	marc[id] = 0;
	backtrack(numteam, id + 1);
}
int c;
int main(){
	scanf("%d %d %d", &n, &k, &c);
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= k; j++){
			scanf("%d", &scores[i][j]);
		}
	}
	backtrack(0, 1);
	sort(allteams.begin(), allteams.end());
	printf("%d\n", allteams[n-c] );
}

컴파일 시 표준 에러 (stderr) 메시지

olympiads.cpp: In function 'int main()':
olympiads.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |  scanf("%d %d %d", &n, &k, &c);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:38:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |    scanf("%d", &scores[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...