Submission #76790

#TimeUsernameProblemLanguageResultExecution timeMemory
76790kdh9949Teams (CEOI11_tea)C++17
0 / 100
340 ms36704 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000005; int n, a[N], p[N]; vector<vector<int>> r; int main(){ scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%d", a + i); iota(p, p + n, 0); sort(p, p + n, [](int x, int y){ return a[x] > a[y]; }); for(int i = 0, j; i < n; i += j){ j = a[p[i]]; if(i + j > n){ for(int k = i, c = r.size() - 1; k < n; k++, c--){ if(c < 0) c = r.size() - 1; r[c].push_back(p[k] + 1); } break; } r.push_back(vector<int>()); for(int k = i; k < i + j; k++) r.back().push_back(p[k] + 1); } printf("%d\n", r.size()); for(const vector<int> &i : r){ printf("%d ", i.size()); for(int j : i) printf("%d ", j); puts(""); } }

Compilation message (stderr)

tea.cpp: In function 'int main()':
tea.cpp:26:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<std::vector<int> >::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n", r.size());
                    ~~~~~~~~^
tea.cpp:28:31: 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 ", i.size());
                       ~~~~~~~~^
tea.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
tea.cpp:11:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 0; i < n; i++) scanf("%d", a + i);
                                ~~~~~^~~~~~~~~~~~~
#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...