Submission #530151

# Submission time Handle Problem Language Result Execution time Memory
530151 2022-02-24T17:22:25 Z Kenzo_1114 Teams (CEOI11_tea) C++17
30 / 100
464 ms 72780 KB
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<pair<int, int> > v(n);
	vector<vector<int> > g(0, vector<int>(0));

	for(int i = 0; i < n; i++)
	{
		cin >> v[i].first;
		v[i].second = i + 1;
	}

	sort(v.begin(), v.end());

	int r = (int) v.size() - 1;
	for(int i = (int) v.size() - 1; i >= 0; i--)
	{
		int val = v[r].first;

		if(r - i + 1 >= val)
		{
			vector<int> cur;
			for(int j = i; j <= r; j++)
				cur.push_back(v[j].second);
			g.push_back(cur);
			r = i - 1;
		}
	}

	int mx = 0;
	for(int i = 0; i < (int) g.size(); i++)
		mx = max(mx, (int) g[i].size());

	while(0 <= r)
	{
		for(int i = 0; i < (int) g.size(); i++)
			while(0 <= r && (int) g[i].size() < mx)
				g[i].push_back(v[r--].second);
		mx++;
	}

	printf("%d\n", (int) g.size());
	for(int i = 0; i < (int) g.size(); i++)
	{
		printf("%d ", (int) g[i].size());
		for(int j = 0; j < (int) g[i].size(); j++)
			printf("%d ", g[i][j]);
		printf("\n");
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 268 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2008 KB Output is correct
2 Correct 35 ms 1860 KB Output is correct
3 Correct 36 ms 1988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 286 ms 14612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 422 ms 20336 KB Output is correct
2 Correct 440 ms 72780 KB Output is correct
3 Incorrect 353 ms 19584 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 464 ms 19056 KB Output is correct
2 Correct 430 ms 18992 KB Output is correct
3 Incorrect 361 ms 19004 KB Output isn't correct
4 Halted 0 ms 0 KB -