# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334712 | 2020-12-09T21:10:39 Z | nikatamliani | Gift (IZhO18_nicegift) | C++14 | 2000 ms | 158072 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e5+10; #define ll long long int main() { int n, k; cin >> n >> k; set<pair<int,int>> s; for(int i = 1; i <= n; ++i) { int x; cin >> x; s.insert({-x, i}); } vector<vector<pair<int,int>>> answer; while(s.begin()->first < 0) { vector<pair<int,int>> v; for(pair<int,int> p : s) { v.push_back(p); if(v.size() == k) break; } for(pair<int,int> p : v) { s.erase(p); p.first++; if(p.first > 0) { cout << "-1\n"; return 0; } s.insert(p); } answer.push_back(v); } cout << answer.size() << '\n'; for(auto v : answer) { cout << 1 << ' '; for(pair<int,int> p : v) { cout << p.second << ' '; } cout << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 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 | 364 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 | 3 ms | 1004 KB | n=8 |
9 | Correct | 10 ms | 1192 KB | n=14 |
10 | Correct | 6 ms | 1004 KB | n=11 |
11 | Correct | 66 ms | 6304 KB | n=50000 |
12 | Correct | 69 ms | 6256 KB | n=50000 |
13 | Correct | 37 ms | 3488 KB | n=10 |
14 | Correct | 37 ms | 3104 KB | n=685 |
15 | Correct | 39 ms | 3360 KB | n=623 |
16 | Correct | 24 ms | 2084 KB | n=973 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 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 | 3 ms | 1004 KB | n=8 |
9 | Correct | 10 ms | 1192 KB | n=14 |
10 | Correct | 6 ms | 1004 KB | n=11 |
11 | Correct | 66 ms | 6304 KB | n=50000 |
12 | Correct | 69 ms | 6256 KB | n=50000 |
13 | Correct | 37 ms | 3488 KB | n=10 |
14 | Correct | 37 ms | 3104 KB | n=685 |
15 | Correct | 39 ms | 3360 KB | n=623 |
16 | Correct | 24 ms | 2084 KB | n=973 |
17 | Correct | 44 ms | 2596 KB | n=989 |
18 | Correct | 17 ms | 1260 KB | n=563 |
19 | Correct | 29 ms | 1644 KB | n=592 |
20 | Correct | 29 ms | 1772 KB | n=938 |
21 | Correct | 22 ms | 1388 KB | n=747 |
22 | Correct | 25 ms | 1516 KB | n=991 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2052 ms | 158072 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 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 | 3 ms | 1004 KB | n=8 |
9 | Correct | 10 ms | 1192 KB | n=14 |
10 | Correct | 6 ms | 1004 KB | n=11 |
11 | Correct | 66 ms | 6304 KB | n=50000 |
12 | Correct | 69 ms | 6256 KB | n=50000 |
13 | Correct | 37 ms | 3488 KB | n=10 |
14 | Correct | 37 ms | 3104 KB | n=685 |
15 | Correct | 39 ms | 3360 KB | n=623 |
16 | Correct | 24 ms | 2084 KB | n=973 |
17 | Correct | 44 ms | 2596 KB | n=989 |
18 | Correct | 17 ms | 1260 KB | n=563 |
19 | Correct | 29 ms | 1644 KB | n=592 |
20 | Correct | 29 ms | 1772 KB | n=938 |
21 | Correct | 22 ms | 1388 KB | n=747 |
22 | Correct | 25 ms | 1516 KB | n=991 |
23 | Execution timed out | 2052 ms | 158072 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |