Compare commits

..

No commits in common. "16a0d9b3f83e040cf27d09996f5bc2a6ffdb32ac" and "056e29b96c9ad2dfa71894297862c5d9f65d94ef" have entirely different histories.

6 changed files with 1 additions and 150 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -41,6 +41,4 @@
21:
stars: 0
22:
stars: 1
23:
stars: 2
stars: 1

View File

@ -1,32 +0,0 @@
kh-tc
qp-kh
de-cg
ka-co
yn-aq
qp-ub
cg-tb
vc-aq
tb-ka
wh-tc
yn-cg
kh-ub
ta-co
de-co
tc-td
tb-wq
wh-td
ta-ka
td-qp
aq-cg
wq-ub
ub-vc
de-ta
wq-aq
wq-vc
wh-yn
ka-de
kh-ta
co-tc
wh-qp
tb-vc
td-yn

View File

@ -1,50 +0,0 @@
#import "/src/utils.typ": *
#let solve(input) = {
let links = input.split("\n")
let links-dict = (:)
let to-test = ()
for link in links {
let (a, b) = link.split("-")
if a not in links-dict {
links-dict.insert(a, ())
}
if b not in links-dict {
links-dict.insert(b, ())
}
links-dict.at(a).push(b)
links-dict.at(b).push(a)
if a.starts-with("t") {
to-test.push(a)
}
if b.starts-with("t") {
to-test.push(b)
}
}
let total = 0
let groups = ()
for comp1 in to-test.dedup() {
for comp2 in links-dict.at(comp1) {
for comp3 in links-dict.at(comp2) {
if comp1 in links-dict.at(comp3) {
let group = (comp1, comp2, comp3).sorted()
if group not in groups {
total += 1
groups.push(group)
}
}
}
}
}
return total
}
#show-puzzle(
23, 1,
solve,
example: 7
)

View File

@ -1,65 +0,0 @@
#import "/src/utils.typ": *
#let bron-kerbosch(links, R, P, X) = {
if P.len() == 0 and X.len() == 0 {
return if R.len() > 2 {
R.sorted()
} else {
none
}
}
let longest-len = 0
let longest = none
let to-visit = P
for v in to-visit {
let neighbors = links.at(v)
let clique = bron-kerbosch(
links,
R + (v,),
P.filter(n => n in neighbors),
X.filter(n => n in neighbors)
)
if clique != none {
let l = clique.len()
if longest == none or l > longest-len {
longest = clique
longest-len = l
}
}
let _ = P.remove(0)
X.push(v)
}
return longest
}
#let solve(input) = {
let links = input.split("\n")
let links-dict = (:)
let to-test = ()
for link in links {
let (a, b) = link.split("-")
if a not in links-dict {
links-dict.insert(a, ())
}
if b not in links-dict {
links-dict.insert(b, ())
}
links-dict.at(a).push(b)
links-dict.at(b).push(a)
}
let clique = bron-kerbosch(links-dict, (), links-dict.keys(), ())
return clique.join(",")
}
#show-puzzle(
23, 2,
solve,
example: "co,de,ka,ta",
only-example: true
)
#show-result("ab,al,cq,cr,da,db,dr,fw,ly,mn,od,py,uh")

Binary file not shown.