Submission #1058408

# Submission time Handle Problem Language Result Execution time Memory
1058408 2024-08-14T09:52:03 Z vjudge1 Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include "candies.h"

#include <vector>

#include <bits/stdc++.h>


using vi = vector<int>;

vi distribute_candies(vi c, vi l, vi r, vi v) {
    int n = c.size(), q = l.size();
    bool all_poz = true;
    for(auto it : v)
        if(it < 0) all_poz = false;
    if(n <= 2000 && q <= 2000) {
        vi A(n, 0);
        for(int i = 0; i < q; ++i) {
            for(int j = l[i]; j <= r[i]; ++j) {
                A[j] += v[i];
                A[j] = max(A[j], 0);
                A[j] = min(A[j], c[j]);
            }
        }
        return A;
    }
}

Compilation message

candies.cpp:8:12: error: 'vector' does not name a type
    8 | using vi = vector<int>;
      |            ^~~~~~
candies.cpp:10:1: error: 'vi' does not name a type
   10 | vi distribute_candies(vi c, vi l, vi r, vi v) {
      | ^~