230942026-01-16 11:57:36GervidIntervallumok (45 pont)cpp17Wrong answer 1/4516ms868 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <array>

using namespace std;
using ll = long long;

signed main()
{
	iostream::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	vector<int> points(n);
	for (int i = 0; i < n; i++) cin >> points[i];

	vector<pair<array<int, 2>, vector<int>>> ans;

	for (int k = 1; k < n/2+1; k++) {
		int pps = n / k;
		if (k*pps != n) continue;
		int len = 0;
		for (int i = 0; i < n; i += pps) {
			len = max(len, points[i + pps - 1] - points[i]);
		}
		int lastcovered = points[pps - 1], lastpi = pps - 1;
		ans.push_back({ {k, len}, { points[pps-1]-len } });
		if (k == 1) continue;

		while (lastpi + pps < n) {
			if (lastpi + pps + 1 >= n || points[lastpi + pps + 1] - lastcovered - 1 > len) break;
			lastpi += pps;
			lastcovered = min(points[lastpi], lastcovered + len);
			ans.back().second.push_back(lastcovered - len + 1);
		}
		if (lastpi + pps != n-1) ans.pop_back();
		else {
			ans.back().second.push_back(points[lastpi + 1]);
		}
	}
	cout << ans.size() << '\n';
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first[0] << ' ' << ans[i].first[1] << '\n';
		for (int j = 0; j < ans[i].second.size(); j++) cout << ans[i].second[j] << '\n';
	}
}
SubtaskSumTestVerdictTimeMemory
base1/45
1Accepted0/01ms512 KiB
2Wrong answer0/01ms508 KiB
3Wrong answer0/11ms316 KiB
4Wrong answer0/11ms316 KiB
5Wrong answer0/11ms316 KiB
6Accepted1/13ms500 KiB
7Wrong answer0/116ms868 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/28ms564 KiB
10Wrong answer0/28ms564 KiB
11Wrong answer0/28ms504 KiB
12Wrong answer0/29ms564 KiB
13Wrong answer0/28ms564 KiB
14Wrong answer0/21ms316 KiB
15Wrong answer0/22ms452 KiB
16Wrong answer0/22ms316 KiB
17Wrong answer0/23ms316 KiB
18Wrong answer0/23ms500 KiB
19Wrong answer0/214ms564 KiB
20Wrong answer0/214ms564 KiB
21Wrong answer0/214ms564 KiB
22Wrong answer0/214ms568 KiB
23Wrong answer0/214ms564 KiB
24Wrong answer0/29ms756 KiB
25Wrong answer0/28ms564 KiB
26Wrong answer0/28ms564 KiB
27Wrong answer0/214ms836 KiB