Submission #91291

#TimeUsernameProblemLanguageResultExecution timeMemory
91291YottaByteK blocks (IZhO14_blocks)C++14
0 / 100
3 ms732 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;/// inline bool check(int mid) { int sum = 0; for(int i = 1; i < k; i++) { } return false; } 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); int ans = a[n]; for(int i = 1; i < k; i++) ans += a[i]; printf("%d", ans); } /** **/

Compilation message (stderr)

blocks.cpp: In function 'bool check(int)':
blocks.cpp:18:6: warning: unused variable 'sum' [-Wunused-variable]
  int sum = 0;
      ^~~
blocks.cpp: At global scope:
blocks.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
blocks.cpp: In function 'int main()':
blocks.cpp:28: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:30: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...