제출 #1135993

#제출 시각아이디문제언어결과실행 시간메모리
1135993duckindogProgression (NOI20_progression)C++17
15 / 100
3095 ms3684 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 300'000 + 10; int n, q; int d[N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> q; for (int i = 1; i <= n; ++i) cin >> d[i]; while (q--) { int type; cin >> type; if (type == 1) { int l, r, s, c; cin >> l >> r >> s >> c; for (int i = l; i <= r; ++i) d[i] += s + c * (i - l); } else if (type == 2) { int l, r, s, c; cin >> l >> r >> s >> c; for (int i = l; i <= r; ++i) d[i] = s + c * (i - l); } else { int l, r; cin >> l >> r; int answer = 0; for (int i = l + 1, cur = 0; i < r; ++i) { if (d[i] - d[i - 1] == d[i + 1] - d[i]) cur += 1; else cur = 0; answer = max(answer, cur); } cout << answer + (l == r ? 1 : 2) << "\n"; } } }
#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...