Submission #47361

# Submission time Handle Problem Language Result Execution time Memory
47361 2018-05-01T15:14:25 Z Bruteforceman Vrtić (COCI18_vrtic) C++11
32 / 160
3 ms 684 KB
#include "bits/stdc++.h"
using namespace std;
int a[155];
int c[155];
int n;
typedef pair <int, int> pii;

int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for(int i = 1; i <= n; i++) {
		scanf("%d", &c[i]);
	}
	sort(c + 1, c + n + 1);
	int ans = 0;
	for(int i = 1; i <= n-2; i++) {
		ans = max(ans, c[i + 2] - c[i]);
	}
	if(n == 2) ans = max(ans, c[2] - c[1]);

	printf("%d\n", ans);
	for(int i = 1; i <= n; i++) {
		if(i & 1) printf("%d ", c[i]);
	}
	for(int i = n; i >= 1; i--) {
		if(~i & 1) printf("%d ", c[i]);
	}
	printf("\n");
	return 0;
}

Compilation message

vrtic.cpp: In function 'int main(int, const char**)':
vrtic.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
vrtic.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
vrtic.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &c[i]);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 448 KB the dissatisfaction value doesn't match with your answer
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 448 KB the dissatisfaction value doesn't match with your answer
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 448 KB the dissatisfaction value doesn't match with your answer
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 448 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 632 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 660 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 684 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 684 KB the dissatisfaction value doesn't match with your answer
2 Halted 0 ms 0 KB -