-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCinema Line.cpp
More file actions
53 lines (53 loc) · 1.02 KB
/
Cinema Line.cpp
File metadata and controls
53 lines (53 loc) · 1.02 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll n,a;
cin >> n;
vector < int > v;
map < int,int > mp;
for(ll i=0;i<n;i++)
{
cin >> a;
v.push_back(a);
}
if(v[0]>25)
{
cout << "NO" << endl;
return 0;
}
for(ll i=0;i<n;i++)
{
if(v[i]==25)
mp[25]++;
else if(v[i]==50)
{
if(mp[25]>=1)
mp[25]--;
else
{
cout << "NO" << endl;
return 0;
}
mp[50]++;
}
else if(v[i]==100)
{
if(mp[50]>=1 && mp[25]>=1)
{
mp[50]--;
mp[25]--;
}
else if(mp[25]>=3)
mp[25] -= 3;
else
{
cout << "NO" << endl;
return 0;
}
}
}
cout << "YES" << endl;
return 0;
}