← Home
For problem statement at 0-999/100-199/150-159/154/problemD.txt this is a correct solution, but verifier at 0-999/100-199/150-159/154/verifierD.go ends with case 1 failed: expected FIRST 4 got "DRAW" can you fix the verifier? package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var x1, x2, a, b int64
	fmt.Fscan(in, &x1, &x2, &a, &b)

	s := x2 - x1

	if a <= 0 && 0 <= b {
		if a <= s && s <= b {
			fmt.Fprintln(out, "FIRST")
			fmt.Fprintln(out, x2)
		} else {
			fmt.Fprintln(out, "DRAW")
		}
		return
	}

	if a > 0 {
		if s <= 0 {
			fmt.Fprintln(out, "DRAW")
			return
		}
		p := a + b
		r := s % p
		if r == 0 {
			fmt.Fprintln(out, "SECOND")
		} else if a <= r && r <= b {
			fmt.Fprintln(out, "FIRST")
			fmt.Fprintln(out, x1+r)
		} else {
			fmt.Fprintln(out, "DRAW")
		}
		return
	}

	if b < 0 {
		if s >= 0 {
			fmt.Fprintln(out, "DRAW")
			return
		}
		c := -b
		d := -a
		p := c + d
		t := -s
		r := t % p
		if r == 0 {
			fmt.Fprintln(out, "SECOND")
		} else if c <= r && r <= d {
			fmt.Fprintln(out, "FIRST")
			fmt.Fprintln(out, x1-r)
		} else {
			fmt.Fprintln(out, "DRAW")
		}
		return
	}
}