← Home
For problem statement at 2000-2999/2000-2099/2030-2039/2038/problemJ.txt this is a correct solution, but verifier at 2000-2999/2000-2099/2030-2039/2038/verifierJ.go ends with All 6 tests passed. can you fix the verifier? package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var total int64
	for i := 0; i < n; i++ {
		var t string
		var v int64
		fmt.Scan(&t, &v)
		if t == "P" {
			total += v
		} else {
			if v > total {
				fmt.Println("YES")
				total = 0
			} else {
				fmt.Println("NO")
				total -= v
			}
		}
	}
}