Submission #164181

# Submission time Handle Problem Language Result Execution time Memory
164181 2019-11-18T12:46:18 Z luciocf Teams (CEOI11_tea) C++14
0 / 100
427 ms 51820 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 = n; i >= 1; )
	{
		ans++;

		int j;
		for (j = i; i-j+1 <= a[i].first; j--)
			team[ans].push_back(a[j].second);

		i = j;
	}

	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:40: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 27 ms 23928 KB Output is correct
2 Incorrect 27 ms 23800 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 20]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 23804 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 100]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 23800 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 200]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 24056 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 4999]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 23984 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 5000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 25816 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 80005]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 26028 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 90003]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 42112 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 750013]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 392 ms 48820 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 427 ms 51820 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -