Submission #1067401


Source Code Expand

import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scan  = new Scanner(System.in);
    String param  = scan.nextLine();
    String[] info = param.split(" ");

    long nbTown      = Long.parseLong(info[0]);
    long walkFatigue = Long.parseLong(info[1]);
    long teleFatigue = Long.parseLong(info[2]);

    String townInfo = scan.nextLine();
    String[] town = townInfo.split(" ");

    long fatigue = 0;

    for (int i = 1; i < nbTown; i++){

      long v = Long.parseLong(town[i]) - Long.parseLong(town[i-1]);

      if (walkFatigue * v < teleFatigue){
        fatigue += walkFatigue * v;
      }
      else{
        fatigue += teleFatigue;
      }
    }

    System.out.println(fatigue);

  }
}

Submission Info

Submission Time
Task D - Walk and Teleport
User Watake
Language Java8 (OpenJDK 1.8.0)
Score 500
Code Size 778 Byte
Status AC
Exec Time 354 ms
Memory 34332 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 12
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 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 123 ms 9552 KB
sample_02.txt AC 121 ms 9676 KB
sample_03.txt AC 122 ms 9676 KB
subtask_1_balancedmax_01.txt AC 342 ms 33436 KB
subtask_1_balancedmax_02.txt AC 347 ms 33208 KB
subtask_1_max_01.txt AC 354 ms 33500 KB
subtask_1_max_02.txt AC 349 ms 33676 KB
subtask_1_min_01.txt AC 122 ms 9556 KB
subtask_1_onlya_01.txt AC 270 ms 22776 KB
subtask_1_onlyamax_01.txt AC 347 ms 33660 KB
subtask_1_onlyb_01.txt AC 236 ms 17608 KB
subtask_1_onlybmax_01.txt AC 347 ms 33364 KB
subtask_1_rand_01.txt AC 337 ms 34320 KB
subtask_1_rand_02.txt AC 333 ms 34332 KB
subtask_1_rand_03.txt AC 280 ms 20396 KB