Submission #607424

#TimeUsernameProblemLanguageResultExecution timeMemory
607424gonzakia29Dancing Elephants (IOI11_elephants)C++17
Compilation error
0 ms0 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; long long n; long long l, mini, maxi; vector <int> x; void init(int N, int L, int X[]){ n = N; l = L; mini = min(X[0],X[1]); maxi = max(X[0],X[1]); x.push_back(mini); x.push_back(maxi); } int update(int i, int y){ x[i] = y; mini = min(x[0],x[1]); maxi = max(x[0],x[1]); return 1+(maxi-mini>l); } #include "elephants.h" #include <bits/stdc++.h> using namespace std; long long n; long long l, mini, maxi; vector <int> x; void init(int N, int L, int X[]){ n = N; l = L; mini = min(X[0],X[1]); maxi = max(X[0],X[1]); x.push_back(mini); x.push_back(maxi); } int update(int i, int y){ x[i] = y; mini = min(x[0],x[1]); maxi = max(x[0],x[1]); return 1+(maxi-mini>l); }

Compilation message (stderr)

elephants.cpp:29:11: error: redefinition of 'long long int n'
   29 | long long n;
      |           ^
elephants.cpp:5:11: note: 'long long int n' previously declared here
    5 | long long n;
      |           ^
elephants.cpp:30:11: error: redefinition of 'long long int l'
   30 | long long l, mini, maxi;
      |           ^
elephants.cpp:6:11: note: 'long long int l' previously declared here
    6 | long long l, mini, maxi;
      |           ^
elephants.cpp:30:14: error: redefinition of 'long long int mini'
   30 | long long l, mini, maxi;
      |              ^~~~
elephants.cpp:6:14: note: 'long long int mini' previously declared here
    6 | long long l, mini, maxi;
      |              ^~~~
elephants.cpp:30:20: error: redefinition of 'long long int maxi'
   30 | long long l, mini, maxi;
      |                    ^~~~
elephants.cpp:6:20: note: 'long long int maxi' previously declared here
    6 | long long l, mini, maxi;
      |                    ^~~~
elephants.cpp:31:14: error: redefinition of 'std::vector<int> x'
   31 | vector <int> x;
      |              ^
elephants.cpp:7:14: note: 'std::vector<int> x' previously declared here
    7 | vector <int> x;
      |              ^
elephants.cpp:33:6: error: redefinition of 'void init(int, int, int*)'
   33 | void init(int N, int L, int X[]){
      |      ^~~~
elephants.cpp:9:6: note: 'void init(int, int, int*)' previously defined here
    9 | void init(int N, int L, int X[]){
      |      ^~~~
elephants.cpp:42:5: error: redefinition of 'int update(int, int)'
   42 | int update(int i, int y){
      |     ^~~~~~
elephants.cpp:18:5: note: 'int update(int, int)' previously defined here
   18 | int update(int i, int y){
      |     ^~~~~~