Submission #435871

# Submission time Handle Problem Language Result Execution time Memory
435871 2021-06-23T20:24:41 Z paisie Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int ll
#define ll long long
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> pre(n+1, 0), ans(n, 0);
	
	for(int i=0; i<q; i++){
		pre[l[i]]+=v[i];
		pre[r[i]+1]-=v[i];
	}
	
	ans[0] = pre[0];
	
	for(int i=1; i<n; i++){
		ans[i] = ans[i-1]+pre[i];
	}
	
	for(int i=0; i<n; i++){
		ans[i] = min(ans[i], c[i]);
	}
	
	return ans;
 }

Compilation message

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