Submission #17310574


Source Code Expand

Copy
import sys

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

MOD = 10**9 + 7

def f(N, A, B):
    if A + B > N:
        return 0
    k = (N - A + 1) * (N - B + 1)
    n = N - A - B
    l = (n + 2) * (n + 1)
    x = k * k - (k - l)**2
    return x % MOD

T = int(readline())
for _ in range(T):
    N, A, B = map(int, readline().split())
    print(f(N, A, B))

Submission Info

Submission Time
Task D - Squares
User maspy
Language Python (3.8.2)
Score 400
Code Size 434 Byte
Status
Exec Time 220 ms
Memory 9192 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
× 1
× 5
Set Name Test Cases
Sample 01.txt
All 01.txt, 11.txt, 12.txt, 13.txt, 14.txt
Case Name Status Exec Time Memory
01.txt 32 ms 9064 KB
11.txt 189 ms 9192 KB
12.txt 192 ms 9136 KB
13.txt 188 ms 9140 KB
14.txt 220 ms 8996 KB