231012026-01-16 12:06:51GervidIntervallumok (45 pont)cpp17Wrong answer 6/4537ms4528 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 = max(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
base6/45
1Accepted0/01ms508 KiB
2Wrong answer0/01ms316 KiB
3Accepted1/11ms316 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/11ms316 KiB
6Accepted1/12ms508 KiB
7Accepted1/116ms820 KiB
8Wrong answer0/21ms500 KiB
9Wrong answer0/214ms1460 KiB
10Wrong answer0/216ms1728 KiB
11Wrong answer0/214ms1660 KiB
12Wrong answer0/216ms1588 KiB
13Wrong answer0/214ms1332 KiB
14Wrong answer0/23ms564 KiB
15Wrong answer0/24ms564 KiB
16Wrong answer0/24ms820 KiB
17Wrong answer0/27ms1076 KiB
18Wrong answer0/28ms1076 KiB
19Wrong answer0/224ms2176 KiB
20Wrong answer0/237ms4528 KiB
21Wrong answer0/237ms4472 KiB
22Wrong answer0/232ms3760 KiB
23Wrong answer0/235ms4272 KiB
24Wrong answer0/29ms564 KiB
25Wrong answer0/217ms2100 KiB
26Wrong answer0/226ms3156 KiB
27Accepted2/213ms564 KiB