← Home
For problem statement at 0-999/700-799/750-759/750/problemC.txt this is a correct solution, but verifier at 0-999/700-799/750-759/750/verifierC.go ends with all tests passed can you fix the verifier? package main

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

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1024*1024), 1024*1024)
}

func readInt() int {
	scanner.Scan()
	res, _ := strconv.Atoi(scanner.Text())
	return res
}

func main() {
	n := readInt()
	L := -2000000000
	R := 2000000000
	S := 0
	
	for i := 0; i < n; i++ {
		c := readInt()
		d := readInt()
		
		if d == 1 {
			if 1900-S > L {
				L = 1900 - S
			}
		} else {
			if 1899-S < R {
				R = 1899 - S
			}
		}
		S += c
	}
	
	if L > R {
		fmt.Println("Impossible")
	} else if R == 2000000000 {
		fmt.Println("Infinity")
	} else {
		fmt.Println(R + S)
	}
}