# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
341666 |
2020-12-30T11:12:41 Z |
Tosic |
Gift (IZhO18_nicegift) |
C++14 |
|
754 ms |
72192 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));
auto tmp = st.end();
vector<pair<int, int> > toE;
for(int i = 0; i < k; ++i){
if(tmp == st.begin()){
cout <<-1;
return 0;
}
--tmp;
toE.push_back(*tmp);
allIdx.back()[i] = tmp->second+1;
}
for(auto i : toE){
st.erase(st.find(i));
if(i.first > 1){
st.insert({i.first-1, i.second});
}
}
}
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 |
Incorrect |
754 ms |
72192 KB |
Jury has the answer but participant has not |
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 |
- |