Submission #1252555

#TimeUsernameProblemLanguageResultExecution timeMemory
1252555bzzzzzzzzzz세계 지도 (IOI25_worldmap)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "worldmap.h" using namespace std; using ll = long long; const SIZE = 41; vector<int> o; vector<int> used(SIZE, 0); vector<vector<int>> g(SIZE); void dfs(int v) { o.push_back(v); used[v] = 1; for (auto i : g[v]) { if (used[i] == 0) { dfs(i); } } o.push_back(v); } std::vector<std::vector<int>> create_map(int N, int M, std::vector<int> A, std::vector<int> B) { int p = 0; for (int i = 0; i < M; i++) { if (A[i] == 1) { p++; } if (B[i] == 1) { p++; } } if (M == N * (N - 1) / 2) { vector<vector<int>> ans(240, vector<int> (240, 1)); int c = 0; int h = 0; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { ans[c][h] = i; ans[c][h + 1] = j; c++; if (c == 240) { c = 0; h += 2; } } } return ans; } else if (M == N - 1 && p != N - 1) { for (int i = 0; i < M; i++) { g[A[i]].push_back(B[i]); g[B[i]].push_back(A[i]); } int n = (int)o.size(); vector<vector<int>> ans(o, vector<int> (o, 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { ans[i][j] = o[i]; } } return ans; } else { int c = 0; int h = 0; for (int i = 0; i < M; i++) { ans[c][h] = A[i]; ans[c][h + 1] = B[j]; c++; if (c == 240) { c = 0; h += 2; } } return ans; } }

Compilation message (stderr)

worldmap.cpp:6:7: error: 'SIZE' does not name a type
    6 | const SIZE = 41;
      |       ^~~~
worldmap.cpp:9:18: error: 'SIZE' was not declared in this scope
    9 | vector<int> used(SIZE, 0);
      |                  ^~~~
worldmap.cpp:10:23: error: 'SIZE' was not declared in this scope
   10 | vector<vector<int>> g(SIZE);
      |                       ^~~~
worldmap.cpp: In function 'std::vector<std::vector<int> > create_map(int, int, std::vector<int>, std::vector<int>)':
worldmap.cpp:55:53: error: no matching function for call to 'std::vector<int>::vector(std::vector<int>&, int)'
   55 |         vector<vector<int>> ans(o, vector<int> (o, 1));
      |                                                     ^
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from worldmap.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:653:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]'
  653 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:653:9: note:   template argument deduction/substitution failed:
worldmap.cpp:55:53: note:   deduced conflicting types for parameter '_InputIterator' ('std::vector<int>' and 'int')
   55 |         vector<vector<int>> ans(o, vector<int> (o, 1));
      |                                                     ^
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from worldmap.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  625 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:625:43: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<int>'
  625 |       vector(initializer_list<value_type> __l,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  607 |       vector(vector&& __rv, const allocator_type& __m)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:607:51: note:   no known conversion for argument 2 from 'int' to 'const allocator_type&' {aka 'const std::allocator<int>&'}
  607 |       vector(vector&& __rv, const allocator_type& __m)
      |                             ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]'
  589 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:589:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/11/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]'
  585 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:585:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/11/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  575 |       vector(const vector& __x, const allocator_type& __a)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:575:55: note:   no known conversion for argument 2 from 'int' to 'const allocator_type&' {aka 'const std::allocator<int>&'}
  575 |       vector(const vector& __x, const allocator_type& __a)
      |                                 ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  572 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:572:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  553 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:553:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  522 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:522:24: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
  522 |       vector(size_type __n, const value_type& __value,
      |              ~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:510:24: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |              ~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:497:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  497 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:497:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:487:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]'
  487 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:487:7: note:   candidate expects 0 arguments, 2 provided
worldmap.cpp:66:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   66 |             ans[c][h] = A[i];
      |             ^~~
      |             abs
worldmap.cpp:67:31: error: 'j' was not declared in this scope
   67 |             ans[c][h + 1] = B[j];
      |                               ^
worldmap.cpp:74:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   74 |         return ans;
      |                ^~~
      |                abs