Submission #1066256
Source Code Expand
#include <stdio.h> #include <string.h> #include <stdbool.h> #define N_MAX 100000 #define M_MAX 200000 #define INF 10000000 #define MOD 1000000007 #define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b)))) typedef unsigned long long ull; typedef signed long long dll; int n, m; int i, j, k; ull a, b; ull x[N_MAX]; typedef struct { int in; int out; } twoway; void deb(){ return; } void solve(){ ull result = 0; int p = 0; while (++p < n) { if ((x[p] - x[p-1]) * a < b) { result += (ull)((x[p] - x[p-1]) * a); } else { result += (ull)b; } } printf("%llu\n", result); return; } int main (void) { scanf("%d%llu%llu", &n, &a, &b); for (i = 0; i < n; i++) scanf("%llu", &x[i]); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Walk and Teleport |
User | sheyasutaka |
Language | C (GCC 5.4.1) |
Score | 500 |
Code Size | 786 Byte |
Status | AC |
Exec Time | 15 ms |
Memory | 896 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:47:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%llu%llu", &n, &a, &b); ^ ./Main.c:48:26: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] for (i = 0; i < n; i++) scanf("%llu", &x[i]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 1 ms | 128 KB |
sample_02.txt | AC | 1 ms | 128 KB |
sample_03.txt | AC | 1 ms | 128 KB |
subtask_1_balancedmax_01.txt | AC | 15 ms | 896 KB |
subtask_1_balancedmax_02.txt | AC | 15 ms | 896 KB |
subtask_1_max_01.txt | AC | 15 ms | 896 KB |
subtask_1_max_02.txt | AC | 15 ms | 896 KB |
subtask_1_min_01.txt | AC | 1 ms | 128 KB |
subtask_1_onlya_01.txt | AC | 8 ms | 512 KB |
subtask_1_onlyamax_01.txt | AC | 15 ms | 896 KB |
subtask_1_onlyb_01.txt | AC | 5 ms | 384 KB |
subtask_1_onlybmax_01.txt | AC | 15 ms | 896 KB |
subtask_1_rand_01.txt | AC | 10 ms | 640 KB |
subtask_1_rand_02.txt | AC | 12 ms | 768 KB |
subtask_1_rand_03.txt | AC | 6 ms | 512 KB |