Submission #832641

#TimeUsernameProblemLanguageResultExecution timeMemory
832641_martynasProgression (NOI20_progression)C++11
15 / 100
3086 ms12428 KiB
#include <iostream> using namespace std; using ll = long long; const int mxn = 3e5+5; int n, q; ll D[mxn]; int main() { cin >> n >> q; for(int i = 1; i <= n; i++) cin >> D[i]; for(int i = 0; i < q; i++) { ll t, l, r, s, c; cin >> t >> l >> r; if(t == 1) { cin >> s >> c; for(int j = l; j <= r; j++) D[j] += s+(j-l)*c; } else if(t == 2) { cin >> s >> c; for(int j = l; j <= r; j++) D[j] = s+(j-l)*c; } else { int ans = 1, diff = D[l+1]-D[l], cnt = 1; for(int j = l+1; j <= r; j++) { if(diff == D[j]-D[j-1]) { cnt++; ans = max(ans, cnt); } else { diff = D[j]-D[j-1], cnt = 2; } } cout << ans << "\n"; } } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...