Submission #498863

# Submission time Handle Problem Language Result Execution time Memory
498863 2021-12-26T13:22:00 Z dnztnc Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
//
//  main.cpp
//  ioi-candies
//
//  Created by Deniz Tanacı on 25.12.2021.
//

#include <iostream>
using namespace std;
int seker_dagit(int sinir,int mevcut,int v){
    if(v<0){
        for(int i=0;i<-v&&mevcut>=1;i++){
            mevcut=mevcut-1;
        }
        return mevcut;
    }
    else{
        for(int i=0;i<v&&mevcut<=(sinir-1);i++){mevcut++;}
        return mevcut;
    }
}

int main() {
    // insert code here...
    int n,q;
    cin>>n;
    int c[n];
    for (int i=0;i<n;i++){cin>>c[i];}
    cin>>q;
    int mevcut[n];
    int l[q],r[q],v[q];
    for (int i=0;i<q;i++){cin>>l[i]>>r[i]>>v[i];}
    
    for(int i=0;i<q;i++){
            
        for(;l[i]<=r[i];l[i]++){mevcut[l[i]]=seker_dagit(c[l[i]], mevcut[l[i]], v[i]);}
        
    }
    
    for(int i=0;i<n;i++){cout<<mevcut[i]<<" ";}
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccq82Rdg.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccGaP1Fc.o:candies.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccq82Rdg.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