We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33df280 commit 354e07dCopy full SHA for 354e07d
atcoder/abc060/C/main.cpp
@@ -0,0 +1,37 @@
1
+#include <bits/stdc++.h>
2
+
3
+using namespace std;
4
+using ll = long long;
5
6
+int N, T;
7
+vector<int> ts;
8
9
+int solve() {
10
+ int X = 0;
11
+ int b = 0, e = 0;
12
+ for (auto t : ts) {
13
+ if (e < t) {
14
+ X += (e - b);
15
+ b = t;
16
+ e = t + T;
17
+ } else {
18
19
+ }
20
21
22
+ return X;
23
+}
24
25
+int main() {
26
+ ios_base::sync_with_stdio(false);
27
+ cin.tie(0); cout.tie(0);
28
29
+ cin >> N >> T;
30
+ ts.assign(N, 0);
31
+ for (int i = 0; i < N; ++i) {
32
+ cin >> ts[i];
33
34
+ cout << solve() << endl;
35
36
+ return 0;
37
0 commit comments