# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92761 | 2019-01-04T13:07:23 Z | Vardanyan | Gift (IZhO18_nicegift) | C++14 | 2000 ms | 8196 KB |
#include<bits/stdc++.h> using namespace std; const int N = 1000*1000+5; pair<int,int> a[N]; int main() { int n,k; scanf("%d%d",&n,&k); int sum = 0; for(int i = 1;i<=n;i++){ scanf("%d",&a[i].first); a[i].second = i; sum+=a[i].first; } sort(a+1,a+1+n); vector<vector<int> > ans; while(1){ int kk = k; vector<int> now; for(int i = n;i>=1;i--){ if(a[i].first<=0){ printf("-1\n"); return 0; } a[i].first--; sum--; now.push_back(a[i].second); kk--; if(kk == 0) break; } ans.push_back(now); if(sum == 0) break; sort(a+1,a+1+n); } printf("%d\n",ans.size()); for(int i = 0;i<ans.size();i++){ printf("1 "); for(int j = 0;j<ans[i].size();j++){ printf("%d ",ans[i][j]); } printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | n=4 |
2 | Correct | 2 ms | 376 KB | n=3 |
3 | Correct | 2 ms | 376 KB | n=3 |
4 | Correct | 2 ms | 376 KB | n=4 |
5 | Correct | 2 ms | 256 KB | n=4 |
6 | Correct | 2 ms | 376 KB | n=2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | n=4 |
2 | Correct | 2 ms | 376 KB | n=3 |
3 | Correct | 2 ms | 376 KB | n=3 |
4 | Correct | 2 ms | 376 KB | n=4 |
5 | Correct | 2 ms | 256 KB | n=4 |
6 | Correct | 2 ms | 376 KB | n=2 |
7 | Correct | 2 ms | 256 KB | n=5 |
8 | Correct | 4 ms | 1016 KB | n=8 |
9 | Correct | 7 ms | 1200 KB | n=14 |
10 | Correct | 5 ms | 1016 KB | n=11 |
11 | Execution timed out | 2056 ms | 1248 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | n=4 |
2 | Correct | 2 ms | 376 KB | n=3 |
3 | Correct | 2 ms | 376 KB | n=3 |
4 | Correct | 2 ms | 376 KB | n=4 |
5 | Correct | 2 ms | 256 KB | n=4 |
6 | Correct | 2 ms | 376 KB | n=2 |
7 | Correct | 2 ms | 256 KB | n=5 |
8 | Correct | 4 ms | 1016 KB | n=8 |
9 | Correct | 7 ms | 1200 KB | n=14 |
10 | Correct | 5 ms | 1016 KB | n=11 |
11 | Execution timed out | 2056 ms | 1248 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 155 ms | 8196 KB | Jury has the answer but participant has not |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | n=4 |
2 | Correct | 2 ms | 376 KB | n=3 |
3 | Correct | 2 ms | 376 KB | n=3 |
4 | Correct | 2 ms | 376 KB | n=4 |
5 | Correct | 2 ms | 256 KB | n=4 |
6 | Correct | 2 ms | 376 KB | n=2 |
7 | Correct | 2 ms | 256 KB | n=5 |
8 | Correct | 4 ms | 1016 KB | n=8 |
9 | Correct | 7 ms | 1200 KB | n=14 |
10 | Correct | 5 ms | 1016 KB | n=11 |
11 | Execution timed out | 2056 ms | 1248 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |