답안 #91292

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91292 2018-12-27T03:11:59 Z YottaByte K개의 묶음 (IZhO14_blocks) C++14
0 / 100
3 ms 608 KB
#include <stdio.h>
#include <algorithm>
using namespace std;

const int N = 1e5;

#define pb push_back
#define ll long long
#define fr first
#define sc second
#define mk make_pair

int n, a[N + 1], k;
ll sum;///

main()
{
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]), sum += a[i];
	
	sort(a + 1, a + 1 + n);
	ll ans = a[n];
	for(int i = 1; i < k; i++)
		ans += a[i];
	
	printf("%lld", ans);
}
/**

**/

Compilation message

blocks.cpp:16:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
blocks.cpp: In function 'int main()':
blocks.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~~
blocks.cpp:20:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]), sum += a[i];
   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Incorrect 2 ms 552 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 552 KB Output is correct
2 Correct 2 ms 552 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Incorrect 2 ms 552 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 608 KB Output isn't correct
2 Halted 0 ms 0 KB -