This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <queue>
using namespace std;
int main()
{
int n,d,T;
cin>>n>>d>>T;
priority_queue <int> m;
int t[n];
int time = 0;
int rebels = 0;
int true_rebels = 0;
for(int i = 0;i<n;i++)
{
cin>>t[i];
}
for(int i = 0;i<n;i++)
{
if(t[i]<=T)
{
time = max(time-1,T-t[i]);
m.push(rebels);
true_rebels+=rebels;
rebels = 0;
true_rebels++;
}
else if(time>0)
{
rebels++;
}
}
for(int i = 0;i<d;i++)
{
if(m.empty() == false)
{
true_rebels -= m.top();
m.pop();
}
}
cout<<true_rebels;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |