- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprison_transfer.cpp
More file actions
Latest commit
36 lines (28 loc) · 657 Bytes
/
Copy pathprison_transfer.cpp
File metadata and controls
36 lines (28 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include<bits/stdc++.h>
usingnamespacestd;
using ll = longlong;
using ii = pair<ll, ll>;
intmain(int argc, charconst *argv[])
{
vector<ll> prisioners;
priority_queue<ll> stack, empty;
ll aux, qtd, max, n_pri, cont=0, ans=0;
cin >> qtd >> max >> n_pri;
for(ll i = 0; i < qtd; i++)
{
cin >> aux;
prisioners.push_back(aux);
}
for(auto& item : prisioners){
if(item <= max)
stack.push(item);
else
stack = empty;
if(stack.size() == n_pri){
ans ++;
stack.pop();
}
}
cout << ans << endl;
return0;
}