Submission #99475

#TimeUsernameProblemLanguageResultExecution timeMemory
99475rzbtDivide and conquer (IZhO14_divide)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define F first #define S second #define all(x) x.begin(),x.end() #define MAXN 100005 typedef long long ll; using namespace std; int seg[MAXN]; int lazy[MAXN]; int dodaj(int l,int d,int tl,int td,int k){ if(lazy[k]){ if(l!=d){ lazy[k+k]+=lazy[k]; lazy[k+k+1]+=lazy[k]; } lazy[k]=0; } if(l>td || d<tl)return -1; if(l>=tl && d<=td){ return seg[k]; } int mid=(l+d)/2; return max( dobij(l,mid,tl,td,k+k,x) , dobij(mid+1,d,tl,td,k+k+1) ); } void dobij(int l,int d,int tl,int td,int k,int x){ if(lazy[k]){ if(l!=d){ lazy[k+k]+=lazy[k]; lazy[k+k+1]+=lazy[k]; } lazy[k]=0; } if(l>td || d<tl)return; if(l>=tl && d<=td){ seg[k]+=(d-l+1)*x; lazy[k]=x; if(l!=d){ lazy[k+k]+=lazy[k]; lazy[k+k+1]+=lazy[k]; } lazy[k]=0; } int mid=(l+d)/2; dodaj(l,mid,tl,td,k+k,x); dodaj(mid+1,d,tl,td,k+k+1,x); } int n; int main() { scanf("%d", &n); int x,z,e,px; scanf("%d %d %d", &x, &z, &e); dodaj() return 0; }

Compilation message (stderr)

divide.cpp: In function 'int dodaj(int, int, int, int, int)':
divide.cpp:28:39: error: 'x' was not declared in this scope
     return max( dobij(l,mid,tl,td,k+k,x) , dobij(mid+1,d,tl,td,k+k+1) );
                                       ^
divide.cpp:28:17: error: 'dobij' was not declared in this scope
     return max( dobij(l,mid,tl,td,k+k,x) , dobij(mid+1,d,tl,td,k+k+1) );
                 ^~~~~
divide.cpp:28:17: note: suggested alternative: 'dodaj'
     return max( dobij(l,mid,tl,td,k+k,x) , dobij(mid+1,d,tl,td,k+k+1) );
                 ^~~~~
                 dodaj
divide.cpp: In function 'void dobij(int, int, int, int, int, int)':
divide.cpp:50:28: error: too many arguments to function 'int dodaj(int, int, int, int, int)'
     dodaj(l,mid,tl,td,k+k,x);
                            ^
divide.cpp:15:5: note: declared here
 int dodaj(int l,int d,int tl,int td,int k){
     ^~~~~
divide.cpp:51:32: error: too many arguments to function 'int dodaj(int, int, int, int, int)'
     dodaj(mid+1,d,tl,td,k+k+1,x);
                                ^
divide.cpp:15:5: note: declared here
 int dodaj(int l,int d,int tl,int td,int k){
     ^~~~~
divide.cpp: In function 'int main()':
divide.cpp:62:11: error: too few arguments to function 'int dodaj(int, int, int, int, int)'
     dodaj()
           ^
divide.cpp:15:5: note: declared here
 int dodaj(int l,int d,int tl,int td,int k){
     ^~~~~
divide.cpp:60:15: warning: unused variable 'px' [-Wunused-variable]
     int x,z,e,px;
               ^~
divide.cpp:59:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
divide.cpp:61:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &x, &z, &e);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~