28612023-01-30 23:27:19bencewokVideójátékgolangWrong answer 0/100131ms56452 KiB
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
    "strings"
)
 
func input() []int {
    var input string
    var output []int
 
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    input = scanner.Text()
 
    inputSplit := strings.Split(input, " ")
 
    for i := 0; i < len(inputSplit); i++ {
        charInt, _ := strconv.Atoi(inputSplit[i])
        output = append(output, charInt)
    }
 
    return output
}
 
func main() {
    var aBreaks, yBreaks []int
    var boretime, boretimeNow, aLenght, yLenght, output int
 
    boretime = input()[0]
 
    aLenght = input()[0]
 
    for i := 0; i < aLenght; i++ {
        ln := input()
        aBreaks = append(aBreaks, ln[0])
        aBreaks = append(aBreaks, ln[1])
    }
 
    yLenght = input()[0]
 
    for i := 0; i < yLenght; i++ {
        ln := input()
        yBreaks = append(yBreaks, ln[0])
        yBreaks = append(yBreaks, ln[1])
    }
 
 
    //chart creation
    var max int
 
    for i := 1; i < len(yBreaks); i++ {
        if max < yBreaks[i] {
            max = yBreaks[i]
        }
    }
 
    for i := 1; i < len(aBreaks); i++ {
        if max < aBreaks[i] {
            max = aBreaks[i]
        }
    }
    charta := make([]int, max)
    charty := make([]int, max)
 
    q, u := 1, 0
    for {
 
        if q > len(aBreaks) {
            break
        }
 
        charta[aBreaks[q]-u-1] = 1
 
        if aBreaks[q]-u == aBreaks[q-1] {
            u = 0
            q = q + 2
        } else {
            u++
        }
        //fmt.Println(charta)
    }
 
    q, u = 1, 0
    for {
        if q > len(yBreaks) {
            break
        }
 
        charty[yBreaks[q]-u-1] = 1
 
        if yBreaks[q]-u == yBreaks[q-1] {
            u = 0
            q = q + 2
        } else {
            u++
        }
        //fmt.Println(charty)
    }
 
    var index int
 
    //fmt.Println(charta)
    //fmt.Println(charty)
 
    for i := 0; i < len(charta); i++ {
        if boretime == boretimeNow {
            index = i
            for charta[index] != 0 {
                charta[index] = 0
                index++
            }
            boretimeNow = 0
        }
 
        if charta[i] == 1 && charta[i] != charty[i] {
            boretimeNow++
        }
 
    }
 
    for i := 0; i < len(charta); i++ {
        if charta[i] == 1 && charta[i] == charty[i] {
            output++
        }
    }
 
    //fmt.Println(charta)
    //fmt.Println(charty)
 
    fmt.Println(output)
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer23ms30028 KiB
2Wrong answer21ms30140 KiB
subtask20/10
3Accepted27ms31144 KiB
4Accepted27ms31336 KiB
5Accepted24ms31360 KiB
6Accepted23ms31348 KiB
7Wrong answer27ms31880 KiB
8Wrong answer24ms31864 KiB
9Accepted23ms31604 KiB
10Wrong answer21ms31696 KiB
11Wrong answer26ms32036 KiB
subtask30/20
12Wrong answer24ms32188 KiB
13Wrong answer21ms32292 KiB
14Wrong answer25ms32604 KiB
15Wrong answer24ms32484 KiB
16Wrong answer25ms32680 KiB
17Runtime error128ms55772 KiB
18Runtime error128ms55096 KiB
19Runtime error126ms55036 KiB
20Runtime error130ms55512 KiB
21Runtime error125ms55700 KiB
22Runtime error123ms55728 KiB
subtask40/30
23Runtime error123ms55800 KiB
24Runtime error125ms55652 KiB
25Runtime error123ms55404 KiB
26Runtime error130ms55500 KiB
27Runtime error130ms56164 KiB
28Runtime error126ms55812 KiB
29Runtime error125ms55768 KiB
30Runtime error129ms55272 KiB
31Runtime error129ms55380 KiB
subtask50/40
32Runtime error125ms55876 KiB
33Runtime error123ms55460 KiB
34Runtime error123ms55900 KiB
35Runtime error131ms56128 KiB
36Runtime error127ms56152 KiB
37Runtime error129ms56172 KiB
38Runtime error128ms55872 KiB
39Runtime error128ms56344 KiB
40Runtime error125ms56376 KiB
41Runtime error128ms56452 KiB