Submission #28323

#TimeUsernameProblemLanguageResultExecution timeMemory
28323lyzqm123 (#68)Wine Tasting (FXCUP2_wine)C++11
0 / 1
0 ms2288 KiB
#include <cstdio>
#include <algorithm>
using namespace std;
int arr[300001];
int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	for (int n = 0;n < N;n++) scanf("%d", &arr[n]);
	sort(arr, arr + N);
	long long ans = arr[N - 1];
	ans += arr[N - 2] - arr[0];
	printf("%lld\n", ans);
	return 0;
}

Compilation message (stderr)

wine.cpp: In function 'int main()':
wine.cpp:7:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &K);
                       ^
wine.cpp:8:48: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int n = 0;n < N;n++) scanf("%d", &arr[n]);
                                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...