# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171135 | 2019-12-27T13:31:57 Z | juggernaut | Gift (IZhO18_nicegift) | C++14 | 2000 ms | 147720 KB |
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; priority_queue<pair<int,int>>q; int n,k,i,x; pair<int,int>a,b; vector<pair<int,int>>ans; main(){ scanf("%lld%lld",&n,&k); for(i=0;i<n;i++){ scanf("%lld",&x); q.push({x,i+1}); } while(!q.empty()){ if(q.size()==1){ puts("-1"); return 0; } a=q.top(); q.pop(); b=q.top(); q.pop(); ans.push_back({b.second,a.second}); if(a.first!=1)q.push({a.first-1,a.second}); if(b.first!=1)q.push({b.first-1,b.second}); } for(auto res:ans)printf("1 %lld %lld\n",res.first,res.second); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2043 ms | 147720 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |