-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path21918.cpp
58 lines (53 loc) · 1007 Bytes
/
21918.cpp
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
// 21918. 전구
// 2021.06.15
// 시뮬레이션
#include<iostream>
using namespace std;
int arr[4001];
int main()
{
int n, m, x, y;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
}
for (int i = 0; i < m; i++)
{
int a;
cin >> a;
switch (a)
{
case 1:
cin >> x >> y;
arr[x] = y;
break;
case 2:
cin >> x >> y;
for (int j = x; j <= y; j++)
{
arr[j] = !arr[j];
}
break;
case 3:
cin >> x >> y;
for (int j = x; j <= y; j++)
{
arr[j] = 0;
}
break;
case 4:
cin >> x >> y;
for (int j = x; j <= y; j++)
{
arr[j] = 1;
}
break;
}
}
for (int i = 1; i <= n; i++)
{
cout << arr[i] << " ";
}
return 0;
}