답안 #91300

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91300 2018-12-27T04:21:34 Z Aydarov03 K개의 묶음 (IZhO14_blocks) C++14
0 / 100
3 ms 608 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[100005];
int ans;

main()
{
    int n , k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        scanf("%d" , &a[i]);

    sort( a + 1 , a + 1 + n );

    ans = a[n];

    for(int i = 1; i < k; i++)
        ans += a[i];

    cout << ans;
}

Compilation message

blocks.cpp:7:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
blocks.cpp: In function 'int main()':
blocks.cpp:12:27: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d" , &a[i]);
                      ~~~~~^
blocks.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d" , &a[i]);
         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 448 KB Output is correct
4 Correct 2 ms 452 KB Output is correct
5 Correct 2 ms 452 KB Output is correct
6 Correct 2 ms 476 KB Output is correct
7 Incorrect 2 ms 476 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 528 KB Output is correct
2 Correct 2 ms 532 KB Output is correct
3 Correct 0 ms 532 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Incorrect 2 ms 600 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 600 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 -