28572023-01-30 15:03:47bencewokVideójátékgolangWrong answer 0/10026ms34064 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() {
	input := input()
	var aBreaks, yBreaks []int
	var boretime, boretimeNow, aLenght, yLenght, output int

	fmt.Println(yLenght)

	//input apprehension
	for i := 0; i < len(input); i++ {
		if i == 0 {
			boretime = input[i]
		} else if i == 1 {
			aLenght = input[i] * 2
		} else if i < aLenght+2 {
			aBreaks = append(aBreaks, input[i])
		} else if i == aLenght+2 {
			yLenght = input[i]
		} else {
			yBreaks = append(yBreaks, input[i])
		}

	}

	//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)

	//fmt.Println(aBreaks, yBreaks)

	/*
		//chart modification (a)
		swi := 1
		swi = 1
		for i := 0; i < len(aBreaks); i++ {
			charta[aBreaks[i]-1] = charta[aBreaks[i]-1] + swi
			if swi == 1 {
				swi = swi - 2
			} else {
				swi = swi + 2
			}
			fmt.Println(charta)
		}
		//chart modification (y)
		swi = 1
		for i := 0; i < len(yBreaks); i++ {
			charty[yBreaks[i]-1] = charty[yBreaks[i]-1] + swi
			if swi == 1 {
				swi = swi - 2
			} else {
				swi = swi + 2
			}
			fmt.Println(charty)
		}
	*/

	//fmt.Println(charty)

	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 answer26ms30024 KiB
2Wrong answer26ms30632 KiB
subtask20/10
3Wrong answer25ms30968 KiB
4Wrong answer25ms30844 KiB
5Wrong answer25ms31500 KiB
6Wrong answer21ms31764 KiB
7Wrong answer21ms31412 KiB
8Wrong answer21ms31636 KiB
9Wrong answer26ms32128 KiB
10Wrong answer24ms32540 KiB
11Wrong answer21ms32332 KiB
subtask30/20
12Wrong answer21ms32276 KiB
13Wrong answer21ms32272 KiB
14Wrong answer21ms31992 KiB
15Wrong answer21ms32136 KiB
16Wrong answer26ms32548 KiB
17Wrong answer24ms32392 KiB
18Wrong answer21ms32300 KiB
19Wrong answer21ms32456 KiB
20Wrong answer25ms32872 KiB
21Wrong answer24ms33024 KiB
22Wrong answer21ms33040 KiB
subtask40/30
23Wrong answer26ms33180 KiB
24Wrong answer25ms32992 KiB
25Wrong answer24ms33104 KiB
26Wrong answer21ms33476 KiB
27Wrong answer21ms33524 KiB
28Wrong answer26ms33580 KiB
29Wrong answer25ms33908 KiB
30Wrong answer24ms33940 KiB
31Wrong answer21ms33860 KiB
subtask50/40
32Wrong answer21ms33772 KiB
33Wrong answer21ms33996 KiB
34Wrong answer25ms34064 KiB
35Wrong answer24ms34020 KiB
36Wrong answer25ms33548 KiB
37Wrong answer24ms34036 KiB
38Wrong answer21ms33380 KiB
39Wrong answer21ms33480 KiB
40Wrong answer26ms33980 KiB
41Wrong answer24ms33740 KiB