Submission #436159

# Submission time Handle Problem Language Result Execution time Memory
436159 2021-06-24T09:41:08 Z Bom164 Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include<iostream>

using namespace std;

#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define mod             1000000007
#define inf             1e18
#define w(x)            int x; cin>>x; while(x--)

void 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(n);
    for(int i=0;i<q;i++){
        int left=l[i];
        int right=r[i];
        for(int j=left;j<=right;j++){
            if(v[i]>0){
                c[j]=min(c[j],0+v[i]);
            }else{
                c[j]=max(0,c[j]+v[i]);
            }
        }
    }
    s=c;
    for(int i=0;i<n;i++){
        cout<<s[i]<<" ";
    }
    cout<<endl;
}

int main(){
    //freopen("4.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    cin>>n;
    vector<int> c(n);
    for(int i=0;i<n;i++){
        cin>>c[i];
    }
    int q;
    cin>>q;
    vector<int> l(q),r(q),v(q);
    for(int i=0;i<q;i++){
        cin>>l[i];
    }
    for(int i=0;i<q;i++){
        cin>>r[i];
    }
    for(int i=0;i<q;i++){
        cin>>v[i];
    }
    distribute_candies(c,l,r,v);
}

Compilation message

/usr/bin/ld: /tmp/ccxiYHSk.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccvzaMUm.o:candies.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status