답안 #909365

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
909365 2024-01-17T07:34:06 Z danikoynov Progression (NOI20_progression) C++14
15 / 100
3000 ms 7616 KB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#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], b[maxn];

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

int query(int l, int r)
{
    if (l == r)
        return 1;

    int cnt = 1, mx = 0;
    for (int i = l + 2; i <= r; i ++)
    {
        if (b[i] == b[i -1])
            cnt ++;
        else
        {
            if (cnt > mx)
                mx = cnt;
            cnt = 1;
        }
    }
    if (cnt > mx)
        mx = cnt;
    return mx + 1;
}
void simulate()
{
    for (int i = 1; i <= q; i ++)
    {
        int type, l, r;
        ll s, c;
        cin >> type >> l >> r;
        if (type == 3)
        {
            cout << query(l, r) << endl;
        }
        else if (type == 1)
        {
            cin >> s >> c;
            for (int j = l; j <= r; j ++)
            {
                d[j] += s + (ll)(j - l) * c;
            }
            b[l] += s;
            for (int j = l + 1; j <= r; j ++)
                b[j] += c;
            b[r + 1] = d[r + 1] - d[r];
        }
        else
        {
            cin >> s >> c;
            for (int j = l; j <= r; j ++)
            {
                d[j] = s + (ll)(j - l) * c;
            }
            for (int j = l + 1; j <= r; j ++)
                b[j] = c;
            b[l] = d[l] - d[l - 1];
            b[r + 1] = d[r + 1] - d[r];
        }

        /**for (int j = 1; j <= n; j ++)
        {

            b[j] = d[j] - d[j - 1];
        }*/
        /**for (int j = 1; j <= n; j ++)
            cout << d[j] << " ";
        cout << endl;*/
    }
}
void solve()
{
    input();
    simulate();
}

int main()
{
    speed();
    solve();
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3027 ms 5456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2520 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 2 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 2 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 5972 KB Output is correct
2 Correct 55 ms 2896 KB Output is correct
3 Correct 57 ms 2908 KB Output is correct
4 Correct 69 ms 2876 KB Output is correct
5 Correct 62 ms 3196 KB Output is correct
6 Correct 56 ms 2992 KB Output is correct
7 Correct 56 ms 3088 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Execution timed out 3073 ms 5568 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 204 ms 5204 KB Output is correct
2 Correct 66 ms 5640 KB Output is correct
3 Correct 65 ms 5736 KB Output is correct
4 Correct 73 ms 5968 KB Output is correct
5 Correct 65 ms 5704 KB Output is correct
6 Correct 65 ms 5616 KB Output is correct
7 Correct 65 ms 5712 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Execution timed out 3034 ms 7616 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 5972 KB Output is correct
2 Correct 55 ms 2896 KB Output is correct
3 Correct 57 ms 2908 KB Output is correct
4 Correct 69 ms 2876 KB Output is correct
5 Correct 62 ms 3196 KB Output is correct
6 Correct 56 ms 2992 KB Output is correct
7 Correct 56 ms 3088 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Execution timed out 3073 ms 5568 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3027 ms 5456 KB Time limit exceeded
2 Halted 0 ms 0 KB -