2858 | 2023-01-30 15:34:20 | bencewok | Videójáték | golang | Wrong answer 0/100 | 128ms | 56540 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)
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 27ms | 29932 KiB | ||||
2 | Wrong answer | 26ms | 30396 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 28ms | 30912 KiB | ||||
4 | Accepted | 27ms | 31092 KiB | ||||
5 | Accepted | 25ms | 31160 KiB | ||||
6 | Accepted | 25ms | 31016 KiB | ||||
7 | Wrong answer | 26ms | 30832 KiB | ||||
8 | Wrong answer | 26ms | 31536 KiB | ||||
9 | Accepted | 25ms | 31196 KiB | ||||
10 | Wrong answer | 26ms | 31720 KiB | ||||
11 | Wrong answer | 24ms | 32072 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Wrong answer | 25ms | 32048 KiB | ||||
13 | Wrong answer | 26ms | 32236 KiB | ||||
14 | Wrong answer | 24ms | 32572 KiB | ||||
15 | Wrong answer | 25ms | 32300 KiB | ||||
16 | Wrong answer | 25ms | 32336 KiB | ||||
17 | Runtime error | 128ms | 54468 KiB | ||||
18 | Runtime error | 125ms | 54752 KiB | ||||
19 | Runtime error | 128ms | 54536 KiB | ||||
20 | Runtime error | 128ms | 54924 KiB | ||||
21 | Runtime error | 125ms | 54724 KiB | ||||
22 | Runtime error | 128ms | 54360 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Runtime error | 125ms | 54540 KiB | ||||
24 | Runtime error | 128ms | 54844 KiB | ||||
25 | Runtime error | 125ms | 55396 KiB | ||||
26 | Runtime error | 128ms | 55204 KiB | ||||
27 | Runtime error | 128ms | 55624 KiB | ||||
28 | Runtime error | 125ms | 55588 KiB | ||||
29 | Runtime error | 128ms | 55120 KiB | ||||
30 | Runtime error | 128ms | 55996 KiB | ||||
31 | Runtime error | 125ms | 55276 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Runtime error | 128ms | 55844 KiB | ||||
33 | Runtime error | 125ms | 55576 KiB | ||||
34 | Runtime error | 123ms | 55744 KiB | ||||
35 | Runtime error | 128ms | 56036 KiB | ||||
36 | Runtime error | 123ms | 55876 KiB | ||||
37 | Runtime error | 122ms | 56016 KiB | ||||
38 | Runtime error | 128ms | 55772 KiB | ||||
39 | Runtime error | 128ms | 56540 KiB | ||||
40 | Runtime error | 125ms | 55968 KiB | ||||
41 | Runtime error | 122ms | 56492 KiB |