Submission #164187

# Submission time Handle Problem Language Result Execution time Memory
164187 2019-11-18T13:37:50 Z luciocf Teams (CEOI11_tea) C++14
0 / 100
414 ms 43048 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e6+10;

pair<int, int> a[maxn];

vector<int> team[maxn];

int main(void)
{
	int n;
	scanf("%d", &n);

	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].first);
		a[i].second = i;
	}

	sort(a+1, a+n+1);

	int ans = 0;

	for (int i = 1; i <= n; )
	{
		ans++;

		int j;
		for (j = i; j <= n; )
		{
			team[ans].push_back(a[j].second);

			 if (j-i+1 < a[j].first || (j < n && a[n].first > n-j)) j++;
			 else break;
		}

		i = j+1;
	}

	printf("%d\n", ans);
	for (int i = 1; i <= ans; i++)
	{
		printf("%d", team[i].size());
		for (auto x: team[i])
			printf(" %d", x);
		printf("\n");
	}
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:45:30: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
   printf("%d", team[i].size());
                ~~~~~~~~~~~~~~^
tea.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
tea.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i].first);
   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 28 ms 23800 KB Output is correct
2 Incorrect 24 ms 23800 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 23800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 23864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 23932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 23928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 25572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 25864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 321 ms 38532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 414 ms 43048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 398 ms 42776 KB Output isn't correct
2 Halted 0 ms 0 KB -