Submission #1195004

#TimeUsernameProblemLanguageResultExecution timeMemory
1195004nikulidIdeal city (IOI12_city)C++20
Compilation error
0 ms0 KiB
#include <climits> #include <vector> /* lemma: I will solve subtask 4 */ double ans=0; vector<vector<int>> visitted, exists; // both are [y][x] vector<vector<bool> DONE; int bfs(int I, int x, int y, int curdist){ // coords is [x,y] visitted[y][x] = I; ans = ans%1000000000; if(exists[y+1][x+1] && visitted[y+1][x+1] != I){ ans += curdist+1; ans /= 2; bfs(I, x+1, y+1, curdist+1); } if(exists[y+1][x-1] && visitted[y+1][x-1] != I){ ans += curdist+1; ans /= 2; bfs(I, x-1, y+1, curdist+1); } if(exists[y-1][x+1] && visitted[y-1][x+1] != I){ ans += curdist+1; ans /= 2; bfs(I, x+1, y-1, curdist+1); } if(exists[y-1][x-1] && visitted[y-1][x-1] != I){ ans += curdist+1; ans /= 2; bfs(I, x-1, y-1, curdist+1); } return; } int DistanceSum(int N, int *X, int *Y) { DONE = vector<vector<bool>>(N+1, N+1, 0) visitted = vector<vector<int>>(N+1, N+1, 0); exists = vector<vector<int>>(N+1, N+1, 0); // find min X and Y values, to translate the graph to start at (1,1) int minX=INT_MAX-1, minY=INT_MAX-1; for(int i=0; i<N; i++){ minX = min(minX, X[i]); minY = min(minY, Y[i]); } for(int i=0; i<N; i++){ exists[Y[i]-minY][X[i]-minX] = 1; } for(int i=0; i<N; i++){ bfs(i, X[i], Y[i], 0); } int realans = ans; return realans; }

Compilation message (stderr)

city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:8: error: 'vector' was not declared in this scope
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      |        ^~~~~~
city.cpp:10:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:10:1: error: 'vector' does not name a type
   10 | vector<vector<int>> visitted, exists; // both are [y][x]
      | ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:8: error: 'vector' was not declared in this scope
   11 | vector<vector<bool> DONE;
      |        ^~~~~~
city.cpp:11:8: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:11:1: error: 'vector' does not name a type
   11 | vector<vector<bool> DONE;
      | ^~~~~~
city.cpp: In function 'int bfs(int, int, int, int)':
city.cpp:14:3: error: 'visitted' was not declared in this scope
   14 |   visitted[y][x] = I;
      |   ^~~~~~~~
city.cpp:15:12: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   15 |   ans = ans%1000000000;
      |         ~~~^~~~~~~~~~~
      |         |   |
      |         |   int
      |         double
city.cpp:16:6: error: 'exists' was not declared in this scope; did you mean 'exit'?
   16 |   if(exists[y+1][x+1] && visitted[y+1][x+1] != I){
      |      ^~~~~~
      |      exit
city.cpp:21:6: error: 'exists' was not declared in this scope; did you mean 'exit'?
   21 |   if(exists[y+1][x-1] && visitted[y+1][x-1] != I){
      |      ^~~~~~
      |      exit
city.cpp:26:6: error: 'exists' was not declared in this scope; did you mean 'exit'?
   26 |   if(exists[y-1][x+1] && visitted[y-1][x+1] != I){
      |      ^~~~~~
      |      exit
city.cpp:31:6: error: 'exists' was not declared in this scope; did you mean 'exit'?
   31 |   if(exists[y-1][x-1] && visitted[y-1][x-1] != I){
      |      ^~~~~~
      |      exit
city.cpp:36:3: error: return-statement with no value, in function returning 'int' [-fpermissive]
   36 |   return;
      |   ^~~~~~
city.cpp: In function 'int DistanceSum(int, int*, int*)':
city.cpp:40:3: error: 'DONE' was not declared in this scope
   40 |   DONE = vector<vector<bool>>(N+1, N+1, 0)
      |   ^~~~
city.cpp:40:17: error: 'vector' was not declared in this scope
   40 |   DONE = vector<vector<bool>>(N+1, N+1, 0)
      |                 ^~~~~~~~~~~~~
city.cpp:40:17: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:40:17: error: 'vector' was not declared in this scope
   40 |   DONE = vector<vector<bool>>(N+1, N+1, 0)
      |                 ^~~~~~~~~~~~~
city.cpp:40:17: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from city.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
city.cpp:42:3: error: 'exists' was not declared in this scope; did you mean 'exit'?
   42 |   exists = vector<vector<int>>(N+1, N+1, 0);
      |   ^~~~~~
      |   exit
city.cpp:42:26: error: expected primary-expression before 'int'
   42 |   exists = vector<vector<int>>(N+1, N+1, 0);
      |                          ^~~
city.cpp:47:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
   47 |     minX = min(minX, X[i]);
      |            ^~~
      |            std::min
In file included from /usr/include/c++/11/vector:62,
                 from city.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~