Submission #91300

#TimeUsernameProblemLanguageResultExecution timeMemory
91300Aydarov03K blocks (IZhO14_blocks)C++14
0 / 100
3 ms608 KiB
#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 (stderr)

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]);
         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...