Submission #91292

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

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