Submission #135185

# Submission time Handle Problem Language Result Execution time Memory
135185 2019-07-23T19:04:02 Z FedericoS Gift (IZhO18_nicegift) C++14
0 / 100
2000 ms 78712 KB
#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
		for(int i=0;i<M;i++){
			for(int x:V[i])
				cout<<x<<" ";
			cout<<"\n";
		}

}
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 70780 KB Same heap occurs twice
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 70780 KB Same heap occurs twice
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 70780 KB Same heap occurs twice
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2055 ms 78712 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 70780 KB Same heap occurs twice
2 Halted 0 ms 0 KB -