Submission #813589

# Submission time Handle Problem Language Result Execution time Memory
813589 2023-08-07T23:03:25 Z danikoynov Progression (NOI20_progression) C++14
15 / 100
3000 ms 4888 KB
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int maxn = 3e5 + 10;

int n, q;
ll d[maxn];
void solve()
{
    cin >> n >> q;
    for (int i = 1; i <= n; i ++)
        cin >> d[i];

    for (int i = 1; i <= q; i ++)
    {
        int type, l, r, s, c;
        cin >> type >> l >> r;
        if (type == 1)
        {
            cin >> s >> c;
            for (int j = l; j <= r; j ++)
                d[j] += s + (j - l) * c;
        }
        else
        if (type == 2)
        {
            cin >> s >> c;
            for (int j = l; j <= r; j ++)
                d[j] = s + (j - l) * c;
        }
        else
        {
            int len = min(r - l, 1), ans = 0;
            for (int j = l + 2; j <= r; j ++)
            {
                if (d[j] - d[j - 1] == d[j - 1] - d[j - 2])
                    len ++;
                else
                {
                    ans = max(ans, len);
                    len = 1;
                }
            }
            ans = max(ans, len);
            cout << ans + 1 << endl;
        }

        /**for (int j = 1; j <= n; j ++)
            cout << d[j] << " ";
        cout << endl;*/
    }
}

int main()
{
    speed();
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3065 ms 2648 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 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 3608 KB Output is correct
2 Correct 56 ms 2896 KB Output is correct
3 Correct 57 ms 2980 KB Output is correct
4 Correct 52 ms 2992 KB Output is correct
5 Correct 60 ms 3148 KB Output is correct
6 Correct 59 ms 3164 KB Output is correct
7 Correct 58 ms 3100 KB Output is correct
8 Correct 1 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 3070 ms 3988 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 222 ms 2932 KB Output is correct
2 Correct 61 ms 3644 KB Output is correct
3 Correct 64 ms 3576 KB Output is correct
4 Correct 63 ms 3656 KB Output is correct
5 Correct 64 ms 3660 KB Output is correct
6 Correct 63 ms 3576 KB Output is correct
7 Correct 63 ms 3660 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Execution timed out 3055 ms 4888 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 3608 KB Output is correct
2 Correct 56 ms 2896 KB Output is correct
3 Correct 57 ms 2980 KB Output is correct
4 Correct 52 ms 2992 KB Output is correct
5 Correct 60 ms 3148 KB Output is correct
6 Correct 59 ms 3164 KB Output is correct
7 Correct 58 ms 3100 KB Output is correct
8 Correct 1 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 3070 ms 3988 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3065 ms 2648 KB Time limit exceeded
2 Halted 0 ms 0 KB -