# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829240 | 2023-08-18T07:24:04 Z | Hanksburger | Cookies (JOI23_cookies) | C++17 | 66 ms | 1152 KB |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec; vector<vector<int> > ans; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, k, sum=0; cin >> n; for (int i=0; i<n; i++) { int x; cin >> x; vec.push_back({x, i+1}); } cin >> m >> k; for (int i=0; i<n; i++) sum+=vec[i].first; if (sum%k) { cout << -1; return 0; } for (int i=0; i<sum/k; i++) { sort(vec.begin(), vec.end(), greater<pair<int, int> >()); vector<int> tmp; for (int j=0; j<k; j++) { if (!vec[j].first) { cout << -1; return 0; } vec[j].first--; tmp.push_back(vec[j].second); } ans.push_back(tmp); } cout << ans.size() << '\n'; for (int i=0; i<ans.size(); i++) { cout << ans[i].size() << ' '; for (int j=0; j<ans[i].size(); j++) cout << ans[i][j] << ' '; cout << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 3 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 468 KB | Output is correct |
10 | Correct | 4 ms | 1152 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 320 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 320 KB | Output is correct |
18 | Correct | 2 ms | 468 KB | Output is correct |
19 | Correct | 66 ms | 628 KB | Output is correct |
20 | Correct | 3 ms | 340 KB | Output is correct |
21 | Correct | 2 ms | 412 KB | Output is correct |
22 | Correct | 2 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |