Submission #411273

#TimeUsernameProblemLanguageResultExecution timeMemory
411273LouayFarahDancing Elephants (IOI11_elephants)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "elephants.h" using namespace std; int n, l; int *x = new(*int); void init(int N, int L, int X[]) { n = N; l = L; x = X; } int solve() { int len = x[0]; len+=l; int res = 1; for(int j = 1; j<n; j++) { if(x[j]>len) { res++; len+=l; } } return res; } int update(int i, int y) { x[i] = y; int j = i; while(j<n-1) { if(x[i]>x[i+1]) swap(x[i], x[i+1]); else break; j++; } j = i; while(j>0) { if(x[i]<x[i-1]) swap(x[i], x[i-1]); else break; j--; } int res = solve(n, l, x); return res; }

Compilation message (stderr)

elephants.cpp:6:14: error: expected type-specifier before '*' token
    6 | int *x = new(*int);
      |              ^
elephants.cpp:6:14: error: expected ')' before '*' token
    6 | int *x = new(*int);
      |             ~^
      |              )
elephants.cpp:6:15: error: expected primary-expression before 'int'
    6 | int *x = new(*int);
      |               ^~~
elephants.cpp: In function 'int update(int, int)':
elephants.cpp:54:28: error: too many arguments to function 'int solve()'
   54 |     int res = solve(n, l, x);
      |                            ^
elephants.cpp:15:5: note: declared here
   15 | int solve()
      |     ^~~~~