Submission #12105307


Source Code Expand

Copy
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7

N, K = map(int, read().split())

k = np.arange(K, N + 2, dtype=np.int64)
low = (k - 1) * k // 2
high = N * k - low
cnt = high - low + 1
print(cnt.sum() % MOD)

Submission Info

Submission Time
Task D - Sum of Large Numbers
User maspy
Language Python (3.8.2)
Score 400
Code Size 327 Byte
Status AC
Exec Time 117 ms
Memory 33688 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 19
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, max_01, max_02, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, random_11, random_12, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_01 AC 114 ms 26916 KB
hand_02 AC 111 ms 27048 KB
max_01 AC 117 ms 33688 KB
max_02 AC 112 ms 33388 KB
random_01 AC 109 ms 29900 KB
random_02 AC 104 ms 27724 KB
random_03 AC 105 ms 27284 KB
random_04 AC 103 ms 27228 KB
random_05 AC 105 ms 27252 KB
random_06 AC 105 ms 27128 KB
random_07 AC 107 ms 30500 KB
random_08 AC 111 ms 33148 KB
random_09 AC 108 ms 30444 KB
random_10 AC 103 ms 27028 KB
random_11 AC 100 ms 27052 KB
random_12 AC 108 ms 27112 KB
sample_01 AC 99 ms 26992 KB
sample_02 AC 101 ms 27088 KB
sample_03 AC 109 ms 30280 KB