Submission #1224186

#TimeUsernameProblemLanguageResultExecution timeMemory
1224186sleepntsheepOlympiads (BOI19_olympiads)C++17
0 / 100
6 ms832 KiB
#include <stdio.h>
#include <algorithm>

using namespace std;

#define N 505
#define K 3

int n, c, k, a[N][K], cc[N * N], tp;

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]);

	if (k == 2) {
		for (int i = 0; i < n; ++i) 
			for (int j = i + 1; j < n; ++j) {
				cc[tp++] = -max(a[i][0], a[j][0]) + -max(a[j][1], a[i][1]);
			}
		sort(cc, cc + tp);
		printf("%d\n", cc[c - 1]);
	} else {
		for (int i = 0; i < n; ++i) 
			cc[tp++] = -a[i][0];
		sort(cc, cc + tp);
		printf("%d\n", -cc[c - 1]);
	}

	return 0;
}

Compilation message (stderr)

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