Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
adc2018-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
adc2018
adc2018-system
Commits
e4e68357
Commit
e4e68357
authored
Jul 16, 2018
by
royus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
require_connect
parent
7c870e2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
5 deletions
+45
-5
solver.c
source/solver.c
+45
-5
No files found.
source/solver.c
View file @
e4e68357
/* solver.c */
/* solver.c */
/* Last Change: 2018/07/
09 (Mon) 15:54:41
. */
/* Last Change: 2018/07/
16 (Mon) 10:05:50
. */
#include<stdio.h>
#include<stdio.h>
/* #include<stdlib.h> */
/* #include<stdlib.h> */
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
/* #include<math.h> */
/* #include<math.h> */
/* #include<time.h> */
/* #include<time.h> */
int
board
[
8
][
72
][
72
];
int
board
[
8
][
72
][
72
]
=
{};
int
avail
[
8
][
72
][
72
]
=
{};
int
depth
,
height
,
width
;
int
depth
,
height
,
width
;
int
lines
;
int
lines
;
//z,y,x
//z,y,x
...
@@ -91,11 +92,50 @@ int connected(int line){
...
@@ -91,11 +92,50 @@ int connected(int line){
return
0
;
return
0
;
}
}
int
connectable
(
int
linea
,
int
lineb
){
int
available
(
int
startx
,
int
starty
,
int
startz
){
//REQUIRED
if
(
avail
[
startz
][
starty
][
startx
]
==-
1
)
return
1
;
if
(
startx
>
0
&&
available
(
startx
-
1
,
starty
,
startz
))
return
1
;
if
(
starty
>
0
&&
available
(
startx
,
starty
-
1
,
startz
))
return
1
;
if
(
startz
>
0
&&
available
(
startx
,
starty
,
startz
-
1
))
return
1
;
if
(
startx
<
depth
&&
available
(
startx
+
1
,
starty
,
startz
))
return
1
;
if
(
starty
<
height
&&
available
(
startx
,
starty
+
1
,
startz
))
return
1
;
if
(
startz
<
width
&&
available
(
startx
,
starty
,
startz
+
1
))
return
1
;
return
0
;
return
0
;
}
}
int
connectable
(
int
linea
,
int
lineb
){
int
startx
=-
1
,
starty
=-
1
,
startz
=-
1
,
notfound
=
1
;
int
i
,
j
,
k
;
for
(
i
=
0
;
i
<
depth
;
i
++
)
for
(
j
=
0
;
j
<
height
;
j
++
)
for
(
k
=
0
;
k
<
width
;
k
++
)
if
(
board
[
i
][
j
][
k
]
==-
linea
)
if
(
notfound
){
notfound
=
0
;
avail
[
i
][
j
][
k
]
=
1
;
startz
=
i
;
starty
=
j
;
startx
=
k
;
}
else
avail
[
i
][
j
][
k
]
=-
1
;
else
if
(
board
[
i
][
j
][
k
]
==
0
||
board
[
i
][
j
][
k
]
==
lineb
||
board
[
i
][
j
][
k
]
==
linea
)
avail
[
i
][
j
][
k
]
=
1
;
else
avail
[
i
][
j
][
k
]
=
0
;
if
(
startx
==-
1
||
starty
==-
1
||
startz
==-
1
){
printf
(
"Error!
\n
"
);
return
0
;
}
return
available
(
startx
,
starty
,
startz
);
}
void
actuallyconnect
(
int
num
){
void
actuallyconnect
(
int
num
){
//REQUIRED
//REQUIRED
return
;
return
;
...
@@ -153,7 +193,7 @@ void write(void){
...
@@ -153,7 +193,7 @@ void write(void){
}
}
int
main
(
void
){
int
main
(
void
){
reset
();
/* reset(); */
read
();
read
();
solve
();
solve
();
write
();
write
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment