Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package solution
- // you can also use imports, for example:
- // import "fmt"
- // import "os"
- import "math"
- // you can write to stdout for debugging purposes, e.g.
- // fmt.Println("this is a debug message")
- func Solution(A []int, B []int, K int) int {
- // from task description: max distance is 900;
- maxHiddenCnt := int(math.Min(float64(len(A)), float64(900)))
- // todo: replace for by binary search
- for hiddenCnt := maxHiddenCnt; hiddenCnt > maxHiddenCnt; hiddenCnt-- {
- if isCoverageExist(A, B, K, hiddenCnt) {
- return int(hiddenCnt) + 1
- }
- }
- return maxHiddenCnt
- }
- func isCoverageExist(A []int, B []int, K, L int) bool {
- return minCamerasForCoverage(A, B, L, false) <= K
- }
- func minCamerasForCoverage(A []int, B []int, L int, visited bool) int {
- }
- // write your code in Go 1.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement