Submission #1189494

#TimeUsernameProblemLanguageResultExecution timeMemory
1189494AgageldiGondola (IOI14_gondola)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" // #include "grader.cpp" #include "gondola.h" #define N 200005 vector <int> v; int vis[N]; int valid(int n, int inputSeq[]) { for(int i = 0; i < n; i++) { if(vis[inputSeq[i]]) return 0; if(inputSeq[i] >= 1 && inputSeq[i] <= n) { v.push_back(i); } vis[inputSeq[i]] = 1; } v.push_back(v[0]); for(int i = 0; i < (int)v.size() - 1; i++) { int x1 = abs(inputSeq[v[i]] - inputSeq[v[i + 1]]); int x2 = abs(v[i] - v[i + 1]); if(min(x2,n - x2) != min(x1, n - x1)) return 0; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp:7:1: error: 'vector' does not name a type
    7 | vector <int> v;
      | ^~~~~~
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:15:7: error: 'v' was not declared in this scope
   15 |       v.push_back(i);
      |       ^
gondola.cpp:19:3: error: 'v' was not declared in this scope
   19 |   v.push_back(v[0]);
      |   ^
gondola.cpp:23:8: error: 'min' was not declared in this scope
   23 |     if(min(x2,n - x2) != min(x1, n - x1)) return 0;
      |        ^~~
gondola.cpp:23:8: note: suggested alternatives:
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from gondola.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   'std::min'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /usr/include/c++/11/algorithm:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from gondola.cpp:1:
/usr/include/c++/11/bits/ranges_algo.h:2957:29: note:   'std::ranges::min'
 2957 |   inline constexpr __min_fn min{};
      |                             ^~~