Submission #3009254


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 Python (3.4.3)
Score 500
Code Size 1446 Byte
Status AC
Exec Time 80 ms
Memory 16652 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 38 ms 5460 KB
sample_02.txt AC 38 ms 5460 KB
sample_03.txt AC 38 ms 5460 KB
subtask_1_balancedmax_01.txt AC 80 ms 16652 KB
subtask_1_balancedmax_02.txt AC 79 ms 16652 KB
subtask_1_max_01.txt AC 77 ms 16652 KB
subtask_1_max_02.txt AC 78 ms 16652 KB
subtask_1_min_01.txt AC 38 ms 5460 KB
subtask_1_onlya_01.txt AC 59 ms 11016 KB
subtask_1_onlyamax_01.txt AC 79 ms 16500 KB
subtask_1_onlyb_01.txt AC 48 ms 8040 KB
subtask_1_onlybmax_01.txt AC 78 ms 16508 KB
subtask_1_rand_01.txt AC 63 ms 12344 KB
subtask_1_rand_02.txt AC 71 ms 14764 KB
subtask_1_rand_03.txt AC 53 ms 9528 KB