#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
using vi = vector<int>;
using vl = vector<long long>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<long long, long long>>;
#define fur(i, a, b) for(ll i = a; i <= (ll)b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll)b; --i)
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const ll mxn = 3e5L + 1;
ll n, q;
ll d[mxn];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> q;
fur(i, 1, n) {
cin >> d[i];
}
ll res = 1;
if(1) {
ll i = 1;
while(i < n) {
ll j = i + 1;
ll diff = d[j] - d[i];
while(j + 1 <= n && d[j + 1] - d[j] == diff) {
++j;
}
res = max(res, j - i + 1);
i = j;
}
}
while(q--) {
ll t;
cin >> t;
if(t == 1) {
ll l, r, s, c;
cin >> l >> r >> s >> c;
// fur(i, l, r) {
// d[i] += s + (i - l) * c;
// }
}
else if(t == 2) {
ll l, r, s, c;
cin >> l >> r >> s >> c;
// fur(i, l, r) {
// d[i] = s + (i - l) * c;
// }
res = n;
}
else if(t == 3) {
ll l, r;
cin >> l >> r;
cout << res << nl;
// ll ans = 1;
// ll i = l;
// while(i < r) {
// ll j = i + 1;
// ll diff = d[j] - d[i];
// while(j + 1 <= r && d[j + 1] - d[j] == diff) {
// ++j;
// }
// ans = max(ans, j - i + 1);
// i = j;
// }
// cout << ans << nl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
3984 KB |
Output is correct |
2 |
Correct |
70 ms |
3488 KB |
Output is correct |
3 |
Correct |
85 ms |
3484 KB |
Output is correct |
4 |
Correct |
72 ms |
3532 KB |
Output is correct |
5 |
Correct |
71 ms |
3616 KB |
Output is correct |
6 |
Correct |
71 ms |
3544 KB |
Output is correct |
7 |
Correct |
69 ms |
3504 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
121 ms |
9928 KB |
Output is correct |
12 |
Correct |
112 ms |
9864 KB |
Output is correct |
13 |
Correct |
122 ms |
10188 KB |
Output is correct |
14 |
Correct |
134 ms |
10148 KB |
Output is correct |
15 |
Correct |
121 ms |
10160 KB |
Output is correct |
16 |
Correct |
120 ms |
9820 KB |
Output is correct |
17 |
Correct |
128 ms |
9844 KB |
Output is correct |
18 |
Correct |
117 ms |
9784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
109 ms |
4372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
134 ms |
3808 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
109 ms |
4372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
3984 KB |
Output is correct |
2 |
Correct |
70 ms |
3488 KB |
Output is correct |
3 |
Correct |
85 ms |
3484 KB |
Output is correct |
4 |
Correct |
72 ms |
3532 KB |
Output is correct |
5 |
Correct |
71 ms |
3616 KB |
Output is correct |
6 |
Correct |
71 ms |
3544 KB |
Output is correct |
7 |
Correct |
69 ms |
3504 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
121 ms |
9928 KB |
Output is correct |
12 |
Correct |
112 ms |
9864 KB |
Output is correct |
13 |
Correct |
122 ms |
10188 KB |
Output is correct |
14 |
Correct |
134 ms |
10148 KB |
Output is correct |
15 |
Correct |
121 ms |
10160 KB |
Output is correct |
16 |
Correct |
120 ms |
9820 KB |
Output is correct |
17 |
Correct |
128 ms |
9844 KB |
Output is correct |
18 |
Correct |
117 ms |
9784 KB |
Output is correct |
19 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |