Submission #17750813


Source Code Expand

Copy
import sys
import numba
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((i8, i8), cache=True)
def main(N, K):
    def f(N, n):
        # count (a, b) s.t. a + b == n
        low = max(1, n - N)
        high = min(N, n - 1)
        x = high - low + 1
        return max(x, 0)

    ans = 0
    for s in range(2, N + N + 1):
        t = s - K
        ans += f(N, s) * f(N, t)
    return ans

a, b = map(int, read().split())

print(main(a, b))

Submission Info

Submission Time
Task B - Quadruple
User maspy
Language Python (3.8.2)
Score 400
Code Size 568 Byte
Status AC
Exec Time 479 ms
Memory 106472 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 21
Set Name Test Cases
Sample 00-sample-001.txt, 00-sample-002.txt
All 00-sample-001.txt, 00-sample-002.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt
Case Name Status Exec Time Memory
00-sample-001.txt AC 479 ms 105776 KB
00-sample-002.txt AC 455 ms 106472 KB
01-001.txt AC 457 ms 105836 KB
01-002.txt AC 451 ms 106268 KB
01-003.txt AC 457 ms 105784 KB
01-004.txt AC 465 ms 104808 KB
01-005.txt AC 461 ms 105160 KB
01-006.txt AC 457 ms 106272 KB
01-007.txt AC 453 ms 106136 KB
01-008.txt AC 457 ms 106272 KB
01-009.txt AC 459 ms 106288 KB
01-010.txt AC 456 ms 106256 KB
01-011.txt AC 456 ms 105152 KB
01-012.txt AC 455 ms 105828 KB
01-013.txt AC 458 ms 106468 KB
01-014.txt AC 456 ms 105516 KB
01-015.txt AC 456 ms 105772 KB
01-016.txt AC 456 ms 105636 KB
01-017.txt AC 453 ms 105760 KB
01-018.txt AC 456 ms 106468 KB
01-019.txt AC 456 ms 104804 KB