Submission #950027

#TimeUsernameProblemLanguageResultExecution timeMemory
950027AbitoCookies (JOI23_cookies)C++17
0 / 100
1 ms452 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long typedef unsigned long long ull; using namespace std; const int N=505; int b[N],n,m; pair<int,int> a[N]; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n; for (int i=1;i<=n;i++) cin>>a[i].F,a[i].S=i; sort(a+1,a+1+n); cin>>m; for (int i=1;i<=m;i++) cin>>b[i]; bool ok=true; vector<vector<int>> ans; for (int i=1;i<=n;i++){ int x=a[i].F-a[i-1].F; //cout<<a[i].F<<' '; if (!x) continue; if (n-i+1<b[1]){ ok=false; break; }//cout<<i<<' '; while (x>0){ vector<int> v; for (int j=i;j<i+b[1];j++) v.pb(a[j].S); ans.pb(v); x--; } } if (!ok){ cout<<-1<<endl; return 0; } cout<<ans.size()<<endl; for (auto v:ans){ cout<<v.size()<<' '; for (auto u:v) cout<<u<<' '; cout<<endl; } 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...