# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532458 | 2022-03-02T22:24:09 Z | definitelynotmee | Teams (CEOI11_tea) | C++ | 285 ms | 72808 KB |
#include<bits/stdc++.h> #define mp make_pair #define mt make_tuple #define all(x) x.begin(), x.end() #define ff first #define ss second using namespace std; template <typename T> using matrix = vector<vector<T>>; typedef unsigned int uint; typedef unsigned long long ull; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1; const double EPS = 1e-7; const int MOD = 1e9 + 7; const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count(); const int MAXN = 1e6+1; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> v(n); for(int i = 0; i < n; i++) cin >> v[i]; vector<int> o(n); iota(all(o),0); sort(all(o),[&](int a, int b){ return v[a] > v[b]; }); matrix<int> resp; int start = 0; while(start < n){ while(start < n && n-start>=v[o[start]]){ resp.push_back({}); for(int i = 0; i < v[o[start]]; i++){ resp.back().push_back(o[i+start]); } start+=v[o[start]]; }; while(start < n && n-start<v[o[start]]){ int ptr = lower_bound(all(resp),resp.back(),[&](const vector<int>&a, const vector<int>&b){ return a.size() > b.size(); })-resp.begin(); while(start < n && n-start<v[o[start]] && ptr < resp.size()){ resp[ptr].push_back(o[start]); ptr++; start++; } } } cout << resp.size() << '\n'; int tot =0; for(vector<int>& i : resp){ tot+=i.size(); } assert(tot == n); for(vector<int>& i : resp){ cout << i.size() << ' '; for(int j : i){ cout << j+1 << ' '; } cout << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 1924 KB | Output is correct |
2 | Correct | 14 ms | 1908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 1996 KB | Output is correct |
2 | Correct | 13 ms | 1944 KB | Output is correct |
3 | Correct | 17 ms | 1960 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 141 ms | 14756 KB | Output is correct |
2 | Correct | 134 ms | 16496 KB | Output is correct |
3 | Correct | 149 ms | 15172 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 199 ms | 19056 KB | Output is correct |
2 | Correct | 285 ms | 72808 KB | Output is correct |
3 | Correct | 164 ms | 21764 KB | Output is correct |
4 | Correct | 214 ms | 16968 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 212 ms | 19068 KB | Output is correct |
2 | Correct | 167 ms | 19052 KB | Output is correct |
3 | Correct | 179 ms | 19780 KB | Output is correct |
4 | Correct | 245 ms | 19188 KB | Output is correct |