Submission #704330


Source Code Expand

#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOR(i,n,m) for (int i=n; i<(int)(m); ++i)
#define ALL(x) x.begin(), x.end()
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define in(i, n) (0 <= (i) && (i) < (n))
#define on(bit, i) (((bit >> i) & 1) == 1)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
const int INF = 1e9+7;

int N, M, T;
int a[100];

int main(void) {
  cin >> N >> M >> T;
  REP(i, N) cin >> a[i]; 
  int res = 0;
  REP(i, N - 1) res += max(0, a[i + 1] - a[i] - 2 * M);
  res += max(0, a[0] - M);
  res += max(0, T - a[N - 1] - M);
  cout << res << endl;
  return 0;
}

Submission Info

Submission Time
Task B - 豪邸と宅配便
User choco_pafe
Language C++14 (GCC 5.4.1)
Score 100
Code Size 720 Byte
Status AC
Exec Time 4 ms
Memory 256 KiB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 23
Set Name Test Cases
All 00_sample_00, 00_sample_01, 00_sample_02, 10_random_01, 10_random_02, 10_random_03, 10_random_04, 10_random_05, 10_random_06, 10_random_07, 10_random_08, 10_random_09, 10_random_10, 20_large_01, 20_large_02, 20_large_03, 20_large_04, 20_large_05, 30_do_not_return01, 30_do_not_return02, 30_do_not_return03, 30_do_not_return04, 30_do_not_return05
Case Name Status Exec Time Memory
00_sample_00 AC 4 ms 256 KiB
00_sample_01 AC 4 ms 256 KiB
00_sample_02 AC 4 ms 256 KiB
10_random_01 AC 4 ms 256 KiB
10_random_02 AC 4 ms 256 KiB
10_random_03 AC 4 ms 256 KiB
10_random_04 AC 4 ms 256 KiB
10_random_05 AC 4 ms 256 KiB
10_random_06 AC 4 ms 256 KiB
10_random_07 AC 4 ms 256 KiB
10_random_08 AC 4 ms 256 KiB
10_random_09 AC 4 ms 256 KiB
10_random_10 AC 4 ms 256 KiB
20_large_01 AC 4 ms 256 KiB
20_large_02 AC 4 ms 256 KiB
20_large_03 AC 4 ms 256 KiB
20_large_04 AC 4 ms 256 KiB
20_large_05 AC 4 ms 256 KiB
30_do_not_return01 AC 4 ms 256 KiB
30_do_not_return02 AC 4 ms 256 KiB
30_do_not_return03 AC 4 ms 256 KiB
30_do_not_return04 AC 4 ms 256 KiB
30_do_not_return05 AC 4 ms 256 KiB