제출 #1039279

#제출 시각아이디문제언어결과실행 시간메모리
1039279happy_nodeThe short shank; Redemption (BOI21_prison)C++17
0 / 100
39 ms8384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MX=2e6+5; int N,D,T; int A[MX]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin>>N>>D>>T; for(int i=1;i<=N;i++) cin>>A[i]; vector<int> stk; priority_queue<int> pq; for(int i=N;i>=1;i--) { if(A[i]<=T) { int cur=A[i], cnt=0; while(stk.size() && stk.back()-i+A[i]<=T) { cnt++; stk.pop_back(); } pq.push(cnt); } else { stk.push_back(i); } } int ans=N; while(pq.size() && D>0) { D--; ans-=pq.top(); pq.pop(); } cout<<ans<<'\n'; }

컴파일 시 표준 에러 (stderr) 메시지

prison.cpp: In function 'int main()':
prison.cpp:22:29: warning: unused variable 'cur' [-Wunused-variable]
   22 |                         int cur=A[i], cnt=0;
      |                             ^~~
#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...