Submission #789111

# Submission time Handle Problem Language Result Execution time Memory
789111 2023-07-21T05:05:50 Z 반딧불(#10041) Cookies (JOI23_cookies) C++17
7 / 100
111 ms 1168 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k;
int a[15002], b[15002];

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%d", &a[i]);
    scanf("%d", &k);
    for(int i=1; i<=k; i++) scanf("%d", &b[i]);

    /// st2
    vector<vector<int> > vec;
    while(1){
        vector<pair<int, int> > v;
        for(int i=1; i<=n; i++) v.push_back(make_pair(a[i], i));
        sort(v.rbegin(), v.rend());
        if(v[0].first == 0) break;
        vec.push_back(vector<int>());
        for(int i=0; i<b[1]; i++){
            if(!v[i].first){
                puts("-1");
                return 0;
            }
            vec.back().push_back(v[i].second);
            a[v[i].second]--;
        }
    }
    printf("%d\n", (int)vec.size());
    for(auto p: vec) {printf("%d ", (int)p.size()); for(auto x: p) printf("%d ", x); puts("");}
}

Compilation message

cookies.cpp: In function 'int main()':
cookies.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
cookies.cpp:12:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for(int i=1; i<=n; i++) scanf("%d", &a[i]);
      |                             ~~~~~^~~~~~~~~~~~~
cookies.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &k);
      |     ~~~~~^~~~~~~~~~
cookies.cpp:14:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for(int i=1; i<=k; i++) scanf("%d", &b[i]);
      |                             ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 16 ms 348 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 4 ms 1168 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 308 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 111 ms 720 KB Output is correct
20 Correct 7 ms 444 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 1 ms 304 KB Output is correct
# 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 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -