Submission #164187

#TimeUsernameProblemLanguageResultExecution timeMemory
164187luciocfTeams (CEOI11_tea)C++14
0 / 100
414 ms43048 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 = 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 (stderr)

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 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...