Submission #537201

# Submission time Handle Problem Language Result Execution time Memory
537201 2022-03-14T17:49:11 Z blue Progression (NOI20_progression) C++17
15 / 100
3000 ms 14464 KB
#include <iostream>
#include <vector>
using namespace std;

using ll = long long;
using vll = vector<ll>;

int main()
{
	int N, Q;
	cin >> N >> Q;

	vll D(1+N);
	for(int i = 1; i <= N; i++) cin >> D[i];

	for(int j = 1; j <= Q; j++)
	{
		int o;
		cin >> o;

		if(o == 1)
		{
			ll L, R, S, C;
			cin >> L >> R >> S >> C;

			for(int i = L; i <= R; i++) 
				D[i] += S + C*(i - L);
		}
		else if(o == 2)
		{
			ll L, R, S, C;
			cin >> L >> R >> S >> C;

			for(int i = L; i <= R; i++)
				D[i] = S + C*(i - L);
		}
		else
		{
			ll L, R;
			cin >> L >> R;

			vll diffs;
			for(int i = L; i < R; i++) diffs.push_back(D[i+1] - D[i]);

			ll res = 0;

			while(!diffs.empty())
			{
				ll v = diffs.back();
				ll curr = 0;
				while(!diffs.empty() && diffs.back() == v)
				{
					curr++;
					diffs.pop_back();
				}
				res = max(res, curr);
			}

			cout << 1+res << '\n';
		}
	}
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 9604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 2 ms 312 KB Output is correct
3 Correct 2 ms 312 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 324 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 3 ms 320 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 3 ms 340 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 899 ms 6840 KB Output is correct
2 Correct 559 ms 760 KB Output is correct
3 Correct 536 ms 972 KB Output is correct
4 Correct 520 ms 912 KB Output is correct
5 Correct 548 ms 976 KB Output is correct
6 Correct 549 ms 936 KB Output is correct
7 Correct 551 ms 1068 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Execution timed out 3059 ms 9696 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 800 ms 14464 KB Output is correct
2 Correct 336 ms 3604 KB Output is correct
3 Correct 352 ms 3748 KB Output is correct
4 Correct 333 ms 3660 KB Output is correct
5 Correct 342 ms 3720 KB Output is correct
6 Correct 344 ms 3620 KB Output is correct
7 Correct 349 ms 3604 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Execution timed out 3058 ms 10828 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 899 ms 6840 KB Output is correct
2 Correct 559 ms 760 KB Output is correct
3 Correct 536 ms 972 KB Output is correct
4 Correct 520 ms 912 KB Output is correct
5 Correct 548 ms 976 KB Output is correct
6 Correct 549 ms 936 KB Output is correct
7 Correct 551 ms 1068 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Execution timed out 3059 ms 9696 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 9604 KB Time limit exceeded
2 Halted 0 ms 0 KB -