Submission #807739

# Submission time Handle Problem Language Result Execution time Memory
807739 2023-08-05T00:12:57 Z Mouad_ouj Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include "candies.h"
#define int long long 
#include<bits/stdc++.h>
using namespace std;
int tree[40000000]={0},lazy[40000000]={0};
void upd(int p,int l,int r,int a,int b,int n)
{
    if(lazy[p]!=0)
    {
        tree[p]+=(r-l+1)*lazy[p];
        if(l!=r)
        {
            lazy[2*p+1]+=lazy[p];
            lazy[2*p+2]+=lazy[p];
        }
        lazy[p]=0;
    }
    if(l>b || r<a)
    return;
    if(l>=a && r<=b)
    {
        tree[p]+=n*(r-l+1);
        if(l!=r)
        {
            lazy[2*p+1]+=n;
            lazy[2*p+2]+=n;
        }
        return;
    }
    int mid=(l+r)/2;
    upd(2*p+1,l,mid,a,b,n);
    upd(2*p+2,mid+1,r,a,b,n);
    tree[p]=tree[2*p+1]+tree[2*p+2];
}
int get(int p,int l,int r,int cur)
{
    if(cur>r || cur<l)
    return 0;
    if(lazy[p]!=0)
    {
        tree[p]+=(r-l+1)*lazy[p];
        if(l!=r)
        {
            lazy[2*p+1]+=lazy[p];
            lazy[2*p+2]+=lazy[p];
        }
        lazy[p]=0;
    }
    if(cur==l && cur==r)
    return tree[p];
    int mid=(l+r)/2;
    return get(2*p+1,l,mid,cur)+get(2*p+2,mid+1,r,cur);
}
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v)
{
    vector<int> a;
    a.assign(c.size(),0);
    for(int y=0;y<l.size();y++)
        upd(0,0,c.size(),l[y],r[y],v[y]);
    for(int x=0;x<c.size();x++)
    a[x]=min(get(0,0,c.size(),x),c[x]);
    return a;
}

Compilation message

candies.cpp:2:13: error: 'long' and 'short' specified together
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long' and 'short' specified together
    2 | #define int long long
      |             ^~~~
candies.cpp:2:13: error: 'long' and 'short' specified together
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long' and 'short' specified together
    2 | #define int long long
      |             ^~~~
candies.cpp:2:13: error: 'long' and 'short' specified together
    2 | #define int long long
      |             ^~~~
In file included from /usr/include/c++/10/cmath:45,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from candies.cpp:3:
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
candies.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
/var/local/li