Submission #405945

#TimeUsernameProblemLanguageResultExecution timeMemory
405945HalogenThe short shank; Redemption (BOI21_prison)C++14
0 / 100
77 ms3336 KiB
#include <bits/stdc++.h> using namespace std; int N, D, T; int A[2000005]; main() { scanf("%d %d %d", &N, &D, &T); for (int i = 0; i < N; i++) scanf("%d", &A[i]); priority_queue<int> pq; int cur = A[0] > T; for (int i = 1; i <= N; i++) { if (A[i] > T) cur++; else { pq.push(cur); cur = 0; } } int ans = 0; for (int i = 0; i < D; i++) { ans += pq.top(); pq.pop(); } printf("%d", N - ans); }

Compilation message (stderr)

prison.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main() {
      | ^~~~
prison.cpp: In function 'int main()':
prison.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d %d", &N, &D, &T);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
prison.cpp:11:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 0; i < N; i++) 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...