Submission #3009253


Source Code Expand

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
import queue
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A, B, X):
    ans = 0
    c = X[0]
    for x in X[1:]:
        ac = A*(x - c)
        if ac > B:
            ans += B
        else:
            ans += ac
        c = x

    return ans


def main():
    N, A, B = read_int_n()
    X = read_int_n()

    print(slv(N, A, B, X))


if __name__ == '__main__':
    main()

Submission Info

Submission Time
Task D - Walk and Teleport
User patahene
Language PyPy3 (2.4.0)
Score 500
Code Size 1446 Byte
Status AC
Exec Time 327 ms
Memory 88428 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_balancedmax_01.txt, subtask_1_balancedmax_02.txt, subtask_1_max_01.txt, subtask_1_max_02.txt, subtask_1_min_01.txt, subtask_1_onlya_01.txt, subtask_1_onlyamax_01.txt, subtask_1_onlyb_01.txt, subtask_1_onlybmax_01.txt, subtask_1_rand_01.txt, subtask_1_rand_02.txt, subtask_1_rand_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 313 ms 65900 KB
sample_02.txt AC 265 ms 64108 KB
sample_03.txt AC 268 ms 64108 KB
subtask_1_balancedmax_01.txt AC 327 ms 88428 KB
subtask_1_balancedmax_02.txt AC 327 ms 88172 KB
subtask_1_max_01.txt AC 320 ms 88300 KB
subtask_1_max_02.txt AC 317 ms 88172 KB
subtask_1_min_01.txt AC 265 ms 64108 KB
subtask_1_onlya_01.txt AC 297 ms 74476 KB
subtask_1_onlyamax_01.txt AC 316 ms 88428 KB
subtask_1_onlyb_01.txt AC 276 ms 68332 KB
subtask_1_onlybmax_01.txt AC 313 ms 88428 KB
subtask_1_rand_01.txt AC 299 ms 75876 KB
subtask_1_rand_02.txt AC 307 ms 79824 KB
subtask_1_rand_03.txt AC 281 ms 71148 KB