Submission #689656

# Submission time Handle Problem Language Result Execution time Memory
689656 2023-01-29T04:57:34 Z saayan007 Progression (NOI20_progression) C++17
15 / 100
3000 ms 3688 KB
#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];
    }

    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;
            }
        }
        else if(t == 3) {
            ll l, r;
            cin >> l >> r;
            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;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3093 ms 2672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 148 ms 3688 KB Output is correct
2 Correct 66 ms 852 KB Output is correct
3 Correct 61 ms 800 KB Output is correct
4 Correct 62 ms 860 KB Output is correct
5 Correct 62 ms 984 KB Output is correct
6 Correct 63 ms 1020 KB Output is correct
7 Correct 64 ms 1100 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 3062 ms 2820 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 275 ms 3020 KB Output is correct
2 Correct 71 ms 620 KB Output is correct
3 Correct 79 ms 460 KB Output is correct
4 Correct 70 ms 468 KB Output is correct
5 Correct 71 ms 388 KB Output is correct
6 Correct 71 ms 460 KB Output is correct
7 Correct 70 ms 476 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 3059 ms 2916 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 148 ms 3688 KB Output is correct
2 Correct 66 ms 852 KB Output is correct
3 Correct 61 ms 800 KB Output is correct
4 Correct 62 ms 860 KB Output is correct
5 Correct 62 ms 984 KB Output is correct
6 Correct 63 ms 1020 KB Output is correct
7 Correct 64 ms 1100 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 3062 ms 2820 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3093 ms 2672 KB Time limit exceeded
2 Halted 0 ms 0 KB -