Submission #532412

#TimeUsernameProblemLanguageResultExecution timeMemory
532412definitelynotmeeTeams (CEOI11_tea)C++98
0 / 100
221 ms19056 KiB
#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]; }); int k = v[o[0]]; matrix<int> resp; int start = 0; while(n-start>k){ resp.push_back({}); for(int i = 0; i < k; i++){ resp.back().push_back(o[i+start]+1); } start+=k; }; int maxi = 0; for(int i = start; i < n; i++){ maxi = max(maxi,v[i]); } if(maxi < n-start){ for(int i = start; i < n; i++){ resp[i%resp.size()].push_back(o[i]+1); } } else { resp.push_back({}); for(int i = start; i < n; i++){ resp.back().push_back(o[i]+1); } } cout << resp.size() << '\n'; for(vector<int>& i : resp){ cout << i.size() << ' '; for(int j : i){ cout << j << ' '; } cout << '\n'; } return 0; }
#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...