public static long Calc(int n) { long ans = 0; var s = new long[n]; for (int i = 0; i < s.Length; i++) { s[i] = long.MaxValue + i % 2 == 0 ? i : -i; } var z = StringLib.ZAlgorithm(s); ans = z[0]; return(ans); }
// verification-helper: PROBLEM https://judge.yosupo.jp/problem/zalgorithm static void Solve(ConsoleReader cr, Utf8ConsoleWriter cw) { string s = cr; cw.WriteLineJoin(StringLib.ZAlgorithm(s)); }