# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
341658 |
2020-12-30T11:05:04 Z |
Tosic |
Gift (IZhO18_nicegift) |
C++14 |
|
2000 ms |
211548 KB |
#include <bits/stdc++.h>
#define maxn 1000010
using namespace std;
int n, k;
int a[maxn];
multiset<pair<int,int>> st;
vector<vector<int> > allIdx;
int main(){
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
cin >> n >> k;
for(int i = 0; i < n; ++i){
cin >> a[i];
st.insert({a[i], i} ) ;
}
while(!st.empty()){
allIdx.push_back(vector<int>(k, 0));
for(int i = 0; i < k; ++i){
if(st.empty()){
cout << -1;
return 0;
}
int lrg = (*--st.end()).first,j = (*--st.end()).second;
st.erase(st.find({lrg, j} ) );
--lrg;
allIdx[allIdx.size()-1][i] = j+1;
if(lrg){
st.insert({lrg, j});
}
}
}
for(auto i : allIdx){
cout << "1 ";
for(auto j:i){
cout << j << ' ';
}
cout << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Taken too much stones from the heap |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Taken too much stones from the heap |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Taken too much stones from the heap |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2082 ms |
211548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Taken too much stones from the heap |
2 |
Halted |
0 ms |
0 KB |
- |