제출 #1271226

#제출 시각아이디문제언어결과실행 시간메모리
1271226talyRabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define lli long long #define pii pair<lli, lli> #define f first #define s second #define pb push_back #define inf 1e9 const lli LOG = 31; #define endl '\n' int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int last = 0; int resp=0; bool mod_f = false; for (int i=0; i<n; i++){ int x; cin >> x; if (last ==0 && x-last>k){ x = k; resp++; mod_f=true; } if (!mod_f){ if (x-last>k){ resp++; } }else{ if (x-last>k){ x = last+k; resp++; }else{ mod_f=false; } } last=x; } cout << resp; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...