Submission #2210398
Source Code Expand
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskX solver = new TaskX(); solver.solve(1, in, out); out.close(); } static class TaskX { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); long a = in.nextLong(); long b = in.nextLong(); long[] x = in.nextLongArray(n); long[] edge = new long[n-1]; for (int i = 0; i < n - 1; i++) { edge[i] = (x[i+1] - x[i]) * a; } // solve long ans = 0; for (int i = 0; i < n - 1; i++) { ans += Math.min(b, edge[i]); } out.println(ans); } } static class ArrayUtils { public static Map<Integer, Integer> getCountMap(int[] array) { Map<Integer, Integer> map = new TreeMap<>(); for (int x : array) map.merge(x, 1, Integer::sum); return map; } } static class InputReader { BufferedReader in; StringTokenizer tok; public String nextString() { while (!tok.hasMoreTokens()) { try { tok = new StringTokenizer(in.readLine(), " "); } catch (IOException e) { throw new InputMismatchException(); } } return tok.nextToken(); } public int nextInt() { return Integer.parseInt(nextString()); } public long nextLong() { return Long.parseLong(nextString()); } public int[] nextIntArray(int n) { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = nextInt(); } return res; } public long[] nextLongArray(int n) { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nextLong(); } return res; } public InputReader(InputStream inputStream) { in = new BufferedReader(new InputStreamReader(inputStream)); tok = new StringTokenizer(""); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Factors of Factorial |
User | tutuz |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 2365 Byte |
Status | RE |
Exec Time | 80 ms |
Memory | 21460 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||
Status |
|
|
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_certain_01.txt, subtask_1_certain_02.txt, subtask_1_certain_03.txt, subtask_1_certain_04.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 | RE | 73 ms | 18128 KB |
sample_02.txt | RE | 71 ms | 19156 KB |
sample_03.txt | RE | 72 ms | 17236 KB |
subtask_1_certain_01.txt | RE | 71 ms | 19412 KB |
subtask_1_certain_02.txt | RE | 80 ms | 18004 KB |
subtask_1_certain_03.txt | RE | 69 ms | 18388 KB |
subtask_1_certain_04.txt | RE | 70 ms | 19412 KB |
subtask_1_rand_01.txt | RE | 72 ms | 19284 KB |
subtask_1_rand_02.txt | RE | 79 ms | 21332 KB |
subtask_1_rand_03.txt | RE | 74 ms | 21460 KB |