Submission #164183

#TimeUsernameProblemLanguageResultExecution timeMemory
164183luciocfTeams (CEOI11_tea)C++14
0 / 100
389 ms42744 KiB
#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; j >= 1 && (i-j+1 <= a[i].first || a[j].first > j); 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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...