Submission #12105307


Source Code Expand

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 KiB

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 KiB
hand_02 AC 111 ms 27048 KiB
max_01 AC 117 ms 33688 KiB
max_02 AC 112 ms 33388 KiB
random_01 AC 109 ms 29900 KiB
random_02 AC 104 ms 27724 KiB
random_03 AC 105 ms 27284 KiB
random_04 AC 103 ms 27228 KiB
random_05 AC 105 ms 27252 KiB
random_06 AC 105 ms 27128 KiB
random_07 AC 107 ms 30500 KiB
random_08 AC 111 ms 33148 KiB
random_09 AC 108 ms 30444 KiB
random_10 AC 103 ms 27028 KiB
random_11 AC 100 ms 27052 KiB
random_12 AC 108 ms 27112 KiB
sample_01 AC 99 ms 26992 KiB
sample_02 AC 101 ms 27088 KiB
sample_03 AC 109 ms 30280 KiB