Submission #135187

#TimeUsernameProblemLanguageResultExecution timeMemory
135187FedericoSGift (IZhO18_nicegift)C++14
7 / 100
2055 ms117880 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int,int> pii; int N,K,M; pii A[1000006]; vector<int> V[3000006]; int main(){ cin>>N>>K; for(int i=0;i<N;i++){ cin>>A[i].first; A[i].second=i+1; } sort(A,A+N,greater<pii>()); while(A[0].first and (M+1)*K<=3000000){ V[M].push_back(A[K-1].first); for(int i=0;i<K;i++){ A[i].first-=A[K-1].first; V[M].push_back(A[i].second); } sort(A,A+N,greater<pii>()); M++; } if(A[0].first) cout<<-1; else{ cout<<M<<"\n"; for(int i=0;i<M;i++){ for(int x:V[i]) cout<<x<<" "; cout<<"\n"; } } }
#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...