답안 #338937

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
338937 2020-12-24T10:06:48 Z kkk K개의 묶음 (IZhO14_blocks) C++14
0 / 100
1 ms 384 KB
#include<iostream>
#define endl '\n'
#include<algorithm>
using namespace std;
long long m[10000004];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n,i,br=1,k,sum=0;
    cin>>n>>k;
    for(i=0;i<n;i++)cin>>m[i];
    sort(m,m+n);
    sum=m[n-1];
    for(i=0;i<min(k-1,n-1);i++)sum+=m[i];
    cout<<sum<<endl;

}

Compilation message

blocks.cpp: In function 'int main()':
blocks.cpp:11:19: warning: unused variable 'br' [-Wunused-variable]
   11 |     long long n,i,br=1,k,sum=0;
      |                   ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 376 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 0 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -