-
Notifications
You must be signed in to change notification settings - Fork 0
/
PROBLEM VIDEO GAME
65 lines (65 loc) · 1 KB
/
PROBLEM VIDEO GAME
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
54
55
56
57
58
59
60
61
62
63
64
65
#include<bits/stdc++.h>
#include <string>
using namespace std;
#define int long long
#define endl "\n"
const int mod=1e9+7;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define clr(a,x) memset(a,x,sizeof(a))
#define T int t;cin>>t; while(t--)
#define vll vector<int>
#define pb push_back
#define sz size
#define str to_string
#define intt stoll
int32_t main()
{
int n,h,x,c,b=1,d=0;
cin>>n>>h;
vll v;
for(int i=0;i<n;i++)
{
cin>>c;
v.pb(c);
}
while(1)
{
cin>>x;
if(x==1)
{
if(b!=1)
b--;
else
continue;
}
else if(x==2)
{
if(b!=n)
b++;
else
continue;
}
else if(x==3)
{
if(v[b-1]>0 && d==0)
{v[b-1]--;
d=1;}
else
continue;
}
else if(x==4)
{
if(v[b-1]<h && d==1)
{
v[b-1]++;
d=0;
}
else
continue;
}
else
break;
}
for(int i=0;i<n;i++)
cout<<v[i]<<" ";
}