Submission #975057

# Submission time Handle Problem Language Result Execution time Memory
975057 2024-05-04T11:05:48 Z pransh_8 Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
//pransh_8
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <algorithm>

using namespace __gnu_pbds;
using namespace std;

//Macros:
#define     fast                            ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define     all(a)                          a.begin(),a.end()
#define     ff                              first
#define     ss                              second
#define     int                             long long
#define     inf                             9223372036854775807
#define     pii                             pair<int, int>
#define     vtr                             vector
#define     pob                             pop_back
#define     pb                              push_back
#define     endl                            "\n"
#define     tab                             "\t"
#define     spc                             ' '
#define     typ                             typename
#define     printif(condition,str1,str2)    cout<<((condition)?str1:str2) << endl
#define     FOR(i, a, n)                    for(int i=a;i<n;++i)
#define     FORR(i, a, n)                   for(int i=a;i>=n;--i)

/*------------------------------Code-Begins----------------------------------*/

vector<int> distribute_candies(vector<int> c, vtr<int> l, vtr<int> r, vtr<int> v) {
    int n = c.size(), q = l.size();
    vtr<int> ans(n);
    FOR(i,0,q) {
        FOR(k,l[i]-1,r[i]) {
            if (v[i]>0)
                ans[k]=min(c[k],ans[k]+v[i]);
            else
                ans[k]=max(0ll,ans[k]+v[i]);
        }
    }
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccPai8hp.o: in function `main':
grader.cpp:(.text.startup+0x30e): undefined reference to `distribute_candies(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status