-
Notifications
You must be signed in to change notification settings - Fork 1
/
boj.10836.cc
86 lines (76 loc) · 1.59 KB
/
boj.10836.cc
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <bits/stdc++.h>
#include <sys/stat.h>
#include <sys/mman.h>
class fio {
size_t rsize;
unsigned char* rbuf;
int ridx;
public:
fio() : ridx(0) {
struct stat rstat;
fstat(0, &rstat);
rsize = rstat.st_size;
rbuf = (unsigned char*)mmap(0, rsize, PROT_READ, MAP_FILE | MAP_PRIVATE, 0, 0);
}
inline bool isBlank() {
return
rbuf[ridx] == '\n' || rbuf[ridx] == '\t' || rbuf[ridx] == '\r' ||
rbuf[ridx] == '\f' || rbuf[ridx] == '\v' || rbuf[ridx] == ' ';
}
inline void consumeBlank() { while (isBlank()) ridx++; }
inline int readInt() {
int res = 0, flag = 0;
consumeBlank();
if (rbuf[ridx] == '-') {
flag = 1;
ridx++;
}
while (!isBlank() && ridx < rsize)
res = 10 * res + rbuf[ridx++] - '0';
return flag ? -res : res;
}
}input;
using namespace std;
typedef long long ll;
int m, n, mat[2*700-1] = {0};
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>m>>n;
for(int d0, d1, d2, i = 0; i<n; ++i)
{
cin>>d0>>d1>>d2;
for(int l = 0; l<2*m-1; ++l)
{
if(l<d0)
{
mat[l] += 0;
}
else if(l<(d0+d1))
{
mat[l] += 1;
}
else
{
mat[l] += 2;
}
}
}
for(int i = m-1; i<2*m-1; ++i)
{
cout<<mat[i]+1<<" ";
}
cout<<"\n";
for(int i = m-2; i>=0; --i)
{
cout<<mat[i]+1<<" ";
for(int l = 0; l<m-1; ++l)
{
cout<<mat[m+l]+1<<" ";
}
cout<<"\n";
}
return 0;
}