Submission #549594

# Submission time Handle Problem Language Result Execution time Memory
549594 2022-04-16T05:33:48 Z kilikuma Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "candies.h"
#define int long long
using namespace std;
vector<int>distribute_candies(vector<int>c,vector<int>l,vector<int>r,vector<int>v) {
  int N = c.size();
  int Q = l.size();
  vector<int> S;
  for (int i=0;i<N;i++)
    S.push_back(0);
  for (int i=0;i<Q;i++) {
    S[l[i]]+=v[i];
    if (r[i]+1!=N)
      S[r[i]+1]-=v[i];
  }
  for (int i=1;i<N;i++)
    S[i]+=S[i-1];
  for (int i=0;i<N;i++)
    S[i]=min(S[i],c[i]);
  return S;
}

Compilation message

/usr/bin/ld: /tmp/ccZUW2GV.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