Submission #1019629

# Submission time Handle Problem Language Result Execution time Memory
1019629 2024-07-11T06:07:15 Z Pacybwoah Cookies (JOI23_cookies) C++17
7 / 100
50 ms 604 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cassert>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n;
    vector<pair<int, int>> vec(n);
    int sum = 0;
    for(int i = 0; i < n; i++) cin >> vec[i].first, sum += vec[i].first, vec[i].second = i + 1;
    cin >> m;
    vector<int> poss(m);
    for(int i = 0; i < m; i++) cin >> poss[i];
    assert(m == 1);
    sort(vec.begin(), vec.end());
    if(sum % poss[0] != 0 || vec.back().first > sum / poss[0]){
        cout << "-1\n";
        return 0;
    }
    cout << sum / poss[0] << "\n";
    for(int i = 0; i < sum / poss[0]; i++){
        cout << poss[0] << " ";
        for(int j = n - poss[0]; j < n; j++) cout << vec[j].second << " \n"[j == (n - 1)], vec[j].first--;
        sort(vec.begin(), vec.end());
    }
}
// g++ -std=c++17 pC.cpp -o run -fsanitize=undefined -fsanitize=address -Wall -Wextra -Wshadow
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 9 ms 464 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 50 ms 484 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -