답안 #813590

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
813590 2023-08-07T23:08:44 Z danikoynov Progression (NOI20_progression) C++14
0 / 100
3000 ms 6036 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;

struct node
{
    int left_val, right_val;
    int left_len, right_len;
    int longest;

    node()
    {
        left_val = right_val = 0;
        left_len = 0;
        right_len = 0;
        longest = 0;
    }


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

    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;
                b[j] += c;
            }
            b[l] += s;
            b[r + 1] -= (s + (r - l) * c);
        }
        else
        if (type == 2)
        {
            cin >> s >> c;
            for (int j = l; j <= r; j ++)
            {
                d[j] = s + (j - l) * c;
                b[j] = c;
            }
            b[l] = d[l] - d[l - 1];
            b[r] = d[r] - d[r - 1];
        }
        else
        {
            if (l == r)
            {
                cout << 1 << endl;
                continue;
            }
            int len = 1, ans = 0;
            for (int j = l + 2; j <= r; j ++)
            {
                if (b[j] == b[j - 1])
                    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;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3080 ms 5128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 6036 KB Output is correct
2 Correct 60 ms 1036 KB Output is correct
3 Correct 63 ms 864 KB Output is correct
4 Correct 51 ms 868 KB Output is correct
5 Correct 55 ms 972 KB Output is correct
6 Correct 56 ms 884 KB Output is correct
7 Correct 56 ms 928 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 3088 ms 5000 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 240 ms 5272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 6036 KB Output is correct
2 Correct 60 ms 1036 KB Output is correct
3 Correct 63 ms 864 KB Output is correct
4 Correct 51 ms 868 KB Output is correct
5 Correct 55 ms 972 KB Output is correct
6 Correct 56 ms 884 KB Output is correct
7 Correct 56 ms 928 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 3088 ms 5000 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3080 ms 5128 KB Time limit exceeded
2 Halted 0 ms 0 KB -