For problem statement at 1000-1999/1100-1199/1170-1179/1172/problemC2.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1170-1179/1172/verifierC2.go ends with build oracle failed: exit status 1
# command-line-arguments
./1172C2.go:16:23: invalid operation: int64(res) * base (mismatched types int64 and int)
./1172C2.go:18:20: invalid operation: int64(base) * base (mismatched types int64 and int)
./1172C2.go:87:26: invalid operation: int64(S_plus + l) * invTot (mismatched types int64 and int)
./1172C2.go:93:31: invalid operation: int64(rem) * invTot (mismatched types int64 and int)
./1172C2.go:103:24: invalid operation: int64(dp[l]) * l (mismatched types int64 and int)
./1172C2.go:107:18: invalid operation: int64(S_plus + EX) * invSp (mismatched types int64 and int)
./1172C2.go:119:22: invalid operation: int64((S_minus % MOD - mMinusEX + MOD) % MOD) * invSm (mismatched types int64 and int)
./1172C2.go:127:23: invalid operation: int64(w[i]) * tMinus (mismatched types int64 and int)
exit status 1 can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
const mod int64 = 998244353
func modPow(a, e int64) int64 {
a %= mod
res := int64(1)
for e > 0 {
if e&1 == 1 {
res = res * a % mod
}
a = a * a % mod
e >>= 1
}
return res
}
func main() {
in := bufio.NewReaderSize(os.Stdin, 1<<20)
var n, m int
fmt.Fscan(in, &n, &m)
a := make([]int, n)
for i := 0; i < n; i++ {
fmt.Fscan(in, &a[i])
}
w := make([]int64, n)
var x, y int64
for i := 0; i < n; i++ {
fmt.Fscan(in, &w[i])
if a[i] == 1 {
x += w[i]
} else {
y += w[i]
}
}
s := x + y
invT := make([]int64, 2*m+1)
for d := -m; d <= m; d++ {
v := s + int64(d)
if v > 0 {
invT[d+m] = modPow(v, mod-2)
}
}
cur := make([]int64, m+2)
nxt := make([]int64, m+2)
cur[0] = 1
for t := 0; t < m; t++ {
for i := 0; i <= m; i++ {
nxt[i] = 0
}
low := 0
if int64(t) > y {
low = int(int64(t) - y)
}
for k := low; k <= t; k++ {
c := cur[k]
if c == 0 {
continue
}
X := x + int64(k)
inv := invT[2*k-t+m]
pl := c * (X % mod) % mod * inv % mod
pd := c - pl
if pd < 0 {
pd += mod
}
nxt[k+1] += pl
if nxt[k+1] >= mod {
nxt[k+1] -= mod
}
nxt[k] += pd
if nxt[k] >= mod {
nxt[k] -= mod
}
}
cur, nxt = nxt, cur
}
var ex, ey int64
low := 0
if int64(m) > y {
low = int(int64(m) - y)
}
for k := low; k <= m; k++ {
p := cur[k]
if p == 0 {
continue
}
ex = (ex + p*((x+int64(k))%mod)) % mod
if y > 0 {
ey = (ey + p*((y-int64(m-k))%mod)) % mod
}
}
fLike := ex * modPow(x%mod, mod-2) % mod
var fDis int64
if y > 0 {
fDis = ey * modPow(y%mod, mod-2) % mod
}
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
var buf []byte
for i := 0; i < n; i++ {
var ans int64
if a[i] == 1 {
ans = (w[i] % mod) * fLike % mod
} else {
ans = (w[i] % mod) * fDis % mod
}
buf = strconv.AppendInt(buf[:0], ans, 10)
out.Write(buf)
if i+1 < n {
out.WriteByte(' ')
}
}
out.WriteByte('\n')
}