Skip to content

Commit

Permalink
Save current progress - 1hr
Browse files Browse the repository at this point in the history
Co-authored-by: Kolatat Thangkasemvathana <kolatat.t@gmail.com>
Co-authored-by: jameskriang <jameskriang@gmail.com>
  • Loading branch information
3 people committed Feb 20, 2020
1 parent a7ba109 commit 6409d9f
Show file tree
Hide file tree
Showing 14 changed files with 84,322 additions and 0 deletions.
30 changes: 30 additions & 0 deletions online-qualification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Google Books ?

## Henlo I am live?WTF

### WTF?

## Problems

Book:
ID
Score

Library:
Set of books
Time it take to scan
Number of books that can be scanned each day

Time:
Days

## Algorithm

- Sturcts of Books and Lib
- Create a scoring mechanism
- Boundary Optimisation - Remove those that were unable do within remaining time
- Sort

## FAQ

https://codingcompetitions.withgoogle.com/hashcode/faq
7 changes: 7 additions & 0 deletions online-qualification/go/common/book.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package common

// Books is a type of all books
type Book struct {
ID uint32
Score uint32
}
9 changes: 9 additions & 0 deletions online-qualification/go/common/library.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package common

type Library struct {
ID uint32
Books []uint32
Score uint32
SignUp uint32
Ship uint32
}
5 changes: 5 additions & 0 deletions online-qualification/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/natebwangsut/hashcode-2020-henlo-fiesta/online-qualification/go

go 1.13

replace github.com/natebwangsut/hashcode-2020-henlo-fiesta/online-qualification/go => ./
44 changes: 44 additions & 0 deletions online-qualification/go/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package main

import (
"fmt"
"log"
"os"

"github.com/natebwangsut/hashcode-2020-henlo-fiesta/online-qualification/go/common"
)

func main() {
f, err := os.Open("../samples/a_example.txt")
if err != nil {
log.Fatal(err)
}
defer f.Close()

// Fuck im too stoopid to open a fucking file
var numBooks, numLibs, numDays uint32
fmt.Fscanf(f, "%d %d %d\n", &numBooks, &numLibs, &numDays)

books := make([]common.Book, numBooks)
for i := range books {
books[i].ID = uint32(i)
fmt.Fscanf(f, "%d", &books[i].Score)
}
fmt.Fscanln(f)

libraries := make([]common.Library, numLibs)
for i := range libraries {
lib := &libraries[i]
var libNumBooks uint32
fmt.Fscanf(f, "%d %d %d\n", &libNumBooks, &lib.SignUp, &lib.Ship)
lib.Books = make([]*common.Book, libNumBooks)
for j := range lib.Books {
var bookId uint32
fmt.Fscanf(f, "%d", &bookId)
lib.Books[j] = &books[j]
}
fmt.Fscanln(f)
}

fmt.Printf("%+v\n", libraries)
}
6 changes: 6 additions & 0 deletions online-qualification/go/score/score.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package score

// ScoreLibrary based on books and its signup time
func ScoreLibrary([]type.Library) []type.Library {

}
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions online-qualification/samples/a_example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
6 2 7
1 2 3 6 5 4
5 2 2
0 1 2 3 4
4 3 1
0 2 3 5
203 changes: 203 additions & 0 deletions online-qualification/samples/b_read_on.txt

Large diffs are not rendered by default.

20,003 changes: 20,003 additions & 0 deletions online-qualification/samples/c_incunabula.txt

Large diffs are not rendered by default.

60,003 changes: 60,003 additions & 0 deletions online-qualification/samples/d_tough_choices.txt

Large diffs are not rendered by default.

2,003 changes: 2,003 additions & 0 deletions online-qualification/samples/e_so_many_books.txt

Large diffs are not rendered by default.

2,003 changes: 2,003 additions & 0 deletions online-qualification/samples/f_libraries_of_the_world.txt

Large diffs are not rendered by default.

0 comments on commit 6409d9f

Please sign in to comment.