FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Problem-Solving/AtCoder/Grid_Coloring.cpp at master · youssefAli11997/Problem-Solving · GitHub
youssefAli11997
/
Problem-Solving
Public
Notifications
You must be signed in to change notification settings
Fork
6
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Problem-Solving
/
AtCoder
/
Grid_Coloring.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
54 lines (50 loc) · 1.11 KB
Breadcrumbs
Problem-Solving
/
AtCoder
/
Grid_Coloring.cpp
Copy path
File metadata and controls
54 lines (50 loc) · 1.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
interesting problem
//
link : https://arc080.contest.atcoder.jp/tasks/arc080_b
#
include
<
bits/stdc++.h
>
using
namespace
std
;
void
printIt
(
int
hw[][
110
],
int
h,
int
w){
for
(
int
i=
0
; i<h; i++){
for
(
int
j=
0
; j<w; j++){
cout<<hw[i][j]<<
"
"
;
}
cout<<endl;
}
cout<<endl;
}
int
main
()
{
int
h,w,n;
int
a[
200000
],hw[
110
][
110
];
cin>>h>>w>>n;
for
(
int
i=
0
;i<n;i++) cin>>a[i];
int
k =
0
, put =
0
;
int
toggle =
0
;
for
(
int
i=
0
; i<h && put < a[k] && k < n; i++){
if
(toggle ==
0
)
for
(
int
j=
0
; j<w; j++){
hw[i][j] = k+
1
;
put++;
if
(put == a[k]){
put =
0
;
k++;
}
}
else
for
(
int
j=w-
1
; j>=
0
; j--){
hw[i][j] = k+
1
;
put++;
if
(put == a[k]){
put =
0
;
k++;
}
}
if
(put < a[k])
toggle =
1
-toggle;
else
{
put =
0
;
k++;
}
}
printIt
(hw,h,w);
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL