# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
378724 | 2021-03-17T03:34:01 Z | iris2617 | Gift (IZhO18_nicegift) | C++14 | 2000 ms | 353424 KB |
#include<bits/stdc++.h> #define int long long #define matsuri pair<int,int> #define iris 1000000007 using namespace std; priority_queue<matsuri> pq; int arr[1000010]; vector<vector<int> > ans; vector<int> ouo; signed main() { ios::sync_with_stdio(0); cin.tie(0); int n,k,i,a; cin>>n>>k; for(i=1;i<=n;i++) { cin>>arr[i]; pq.push({arr[i],i}); } while(pq.size()>=k) { ouo.clear(); for(i=0;i<k;i++) { ouo.emplace_back(pq.top().second); pq.pop(); } ans.emplace_back(ouo); for(int aoi:ouo) { arr[aoi]--; if(arr[aoi]) pq.push({arr[aoi],aoi}); } } if(pq.empty()) { cout<<ans.size()<<'\n'; for(auto sana:ans) { cout<<"1"; for(int aoi:sana) { cout<<" "<<aoi; } cout<<'\n'; } } else { cout<<"-1\n"; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 396 KB | n=4 |
2 | Correct | 1 ms | 364 KB | n=3 |
3 | Correct | 1 ms | 364 KB | n=3 |
4 | Correct | 1 ms | 364 KB | n=4 |
5 | Correct | 1 ms | 364 KB | n=4 |
6 | Correct | 1 ms | 364 KB | n=2 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 396 KB | n=4 |
2 | Correct | 1 ms | 364 KB | n=3 |
3 | Correct | 1 ms | 364 KB | n=3 |
4 | Correct | 1 ms | 364 KB | n=4 |
5 | Correct | 1 ms | 364 KB | n=4 |
6 | Correct | 1 ms | 364 KB | n=2 |
7 | Correct | 1 ms | 364 KB | n=5 |
8 | Correct | 2 ms | 1004 KB | n=8 |
9 | Correct | 7 ms | 1192 KB | n=14 |
10 | Correct | 5 ms | 1004 KB | n=11 |
11 | Correct | 49 ms | 5044 KB | n=50000 |
12 | Correct | 34 ms | 5092 KB | n=50000 |
13 | Correct | 22 ms | 3488 KB | n=10 |
14 | Correct | 29 ms | 3104 KB | n=685 |
15 | Correct | 25 ms | 3360 KB | n=623 |
16 | Correct | 14 ms | 1956 KB | n=973 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 396 KB | n=4 |
2 | Correct | 1 ms | 364 KB | n=3 |
3 | Correct | 1 ms | 364 KB | n=3 |
4 | Correct | 1 ms | 364 KB | n=4 |
5 | Correct | 1 ms | 364 KB | n=4 |
6 | Correct | 1 ms | 364 KB | n=2 |
7 | Correct | 1 ms | 364 KB | n=5 |
8 | Correct | 2 ms | 1004 KB | n=8 |
9 | Correct | 7 ms | 1192 KB | n=14 |
10 | Correct | 5 ms | 1004 KB | n=11 |
11 | Correct | 49 ms | 5044 KB | n=50000 |
12 | Correct | 34 ms | 5092 KB | n=50000 |
13 | Correct | 22 ms | 3488 KB | n=10 |
14 | Correct | 29 ms | 3104 KB | n=685 |
15 | Correct | 25 ms | 3360 KB | n=623 |
16 | Correct | 14 ms | 1956 KB | n=973 |
17 | Correct | 24 ms | 2724 KB | n=989 |
18 | Correct | 11 ms | 1260 KB | n=563 |
19 | Correct | 17 ms | 1772 KB | n=592 |
20 | Correct | 18 ms | 1644 KB | n=938 |
21 | Correct | 16 ms | 1516 KB | n=747 |
22 | Correct | 15 ms | 1516 KB | n=991 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2111 ms | 353424 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 396 KB | n=4 |
2 | Correct | 1 ms | 364 KB | n=3 |
3 | Correct | 1 ms | 364 KB | n=3 |
4 | Correct | 1 ms | 364 KB | n=4 |
5 | Correct | 1 ms | 364 KB | n=4 |
6 | Correct | 1 ms | 364 KB | n=2 |
7 | Correct | 1 ms | 364 KB | n=5 |
8 | Correct | 2 ms | 1004 KB | n=8 |
9 | Correct | 7 ms | 1192 KB | n=14 |
10 | Correct | 5 ms | 1004 KB | n=11 |
11 | Correct | 49 ms | 5044 KB | n=50000 |
12 | Correct | 34 ms | 5092 KB | n=50000 |
13 | Correct | 22 ms | 3488 KB | n=10 |
14 | Correct | 29 ms | 3104 KB | n=685 |
15 | Correct | 25 ms | 3360 KB | n=623 |
16 | Correct | 14 ms | 1956 KB | n=973 |
17 | Correct | 24 ms | 2724 KB | n=989 |
18 | Correct | 11 ms | 1260 KB | n=563 |
19 | Correct | 17 ms | 1772 KB | n=592 |
20 | Correct | 18 ms | 1644 KB | n=938 |
21 | Correct | 16 ms | 1516 KB | n=747 |
22 | Correct | 15 ms | 1516 KB | n=991 |
23 | Execution timed out | 2111 ms | 353424 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |