Submission #604747

#TimeUsernameProblemLanguageResultExecution timeMemory
604747hibikiThe short shank; Redemption (BOI21_prison)C++11
0 / 100
65 ms7640 KiB
#include<bits/stdc++.h> using namespace std; int n, d, t; int a[2000005]; int cur = 0, cnt = 0; int ans = 0; priority_queue<int> g; int main() { scanf("%d %d %d", &n, &d, &t); for(int i = 0; i < n; i++) { scanf("%d", &a[i]); cur++; if(a[i] <= t) { ans++; ans += cnt; if(cnt) g.push(cnt); cur = a[i]; cnt = 0; } else if(cur <= t) cnt++; } ans += cnt; if(cnt) g.push(cnt); cnt = 0; while(!g.empty() && cnt < d) { ans -= g.top(); g.pop(); cnt++; } printf("%d\n",ans); return 0; }

Compilation message (stderr)

prison.cpp: In function 'int main()':
prison.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d %d", &n, &d, &t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
prison.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         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...