# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48521 | 2018-05-15T12:49:12 Z | Pajaraja | Gift (IZhO18_nicegift) | C++17 | 2000 ms | 30112 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n,k,t,cnt=0; scanf("%d%d",&n,&k); priority_queue<pair<int,int> > pq,pq1; for(int i=0;i<n;i++) {scanf("%d",&t); pq.push(make_pair(t,i+1)); pq1.push(make_pair(t,i+1));} while(pq.size()>=k) { stack<pair<int,int> > st; for(int i=0;i<k;i++) {st.push(pq.top()); pq.pop();} for(int i=0;i<k;i++) {st.top().first--; if(st.top().first!=0) pq.push(st.top()); st.pop();} cnt++; } if(!pq.empty()) {printf("-1"); return 0;} printf("%d\n",cnt); while(pq1.size()>=k) { stack<pair<int,int> > st; for(int i=0;i<k;i++) {st.push(pq1.top()); pq1.pop();} for(int i=0;i<k;i++) {st.top().first--; if(st.top().first!=0) pq1.push(st.top()); printf("%d ",st.top().second); st.pop();} printf("1\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Taken too much stones from the heap |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Taken too much stones from the heap |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Taken too much stones from the heap |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2075 ms | 30112 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Taken too much stones from the heap |
2 | Halted | 0 ms | 0 KB | - |