Submission #29043

#TimeUsernameProblemLanguageResultExecution timeMemory
29043aybalaDancing Elephants (IOI11_elephants)C++11
Compilation error
0 ms0 KiB
#include "elephants.h" #include<bits/stdc++.h> #define fori(a,b,c) for(a=b; a<c; a++) #define ford(a,b,c) for(a=b; a>=c; a--) #define mp make_pair #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; int n; int cam; void init(int N, int L, int X[]) { int i,j,k; int l = X[0]; cam = 1; fori(i,1,N){ if(X[i]-l>L){ l=X[i]; cam++; } } } int update(int i, int y) { if(i==2){ X[0]=X[1]=y; return cam; } if(i==1){ if(abs(X[1]-y)>abs(X[0]-y)){ X[1]=y; } else{ X[0]=y; } int l = X[0]; cam = 1; fori(i,1,N){ if(X[i]-l>L){ l=X[i]; cam++; } } } return cam; }

Compilation message (stderr)

elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:18:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j,k;
        ^
elephants.cpp:18:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k;
          ^
elephants.cpp: In function 'int update(int, int)':
elephants.cpp:33:3: error: 'X' was not declared in this scope
   X[0]=X[1]=y;
   ^
elephants.cpp:38:10: error: 'X' was not declared in this scope
   if(abs(X[1]-y)>abs(X[0]-y)){
          ^
elephants.cpp:44:11: error: 'X' was not declared in this scope
   int l = X[0];
           ^
elephants.cpp:46:12: error: 'N' was not declared in this scope
   fori(i,1,N){
            ^
elephants.cpp:3:32: note: in definition of macro 'fori'
 #define fori(a,b,c) for(a=b; a<c; a++)
                                ^
elephants.cpp:47:14: error: 'L' was not declared in this scope
    if(X[i]-l>L){
              ^