Submission #1266932

#TimeUsernameProblemLanguageResultExecution timeMemory
1266932dhuyyyyRabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> #define fi first #define se second #define int long long using namespace std; using ll = long long; using ii = pair<int,int>; using pii = pair<int,ii>; using aa = array<int,3>; const int N = 2e5+5; const int M = 1e5+5; const int INF = 1e9; const int MOD = 1e9+7; int n, t, x, s, res = 0, a[N]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> t; for (int i = 1; i <= n; i++) cin >> a[i]; if (a[1] > t){ res++; a[1] = t; for (int i = 1; i < n; i++){ if (a[i+1] - a[i] > t){ a[i+1] = a[i] + t; res++; } } cout << res << '\n'; return 0; } for (int i = 1; i < n; i++){ if (a[i+1] - a[i] > t){ res++; } } cout << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...