Submission #1180188

#TimeUsernameProblemLanguageResultExecution timeMemory
1180188PlayVoltzStray Cat (JOI20_stray)C++20
Compilation error
0 ms0 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second vector<int> Mark(int n, int m, int A, int B, vector<int> u, vector<int> v){ vector<vector<int> > graph(n); vector<int> res(m, -1), a, vect(n, -1); for (int i=0; i<m; ++i){ graph[u[i]].pb(i); graph[v[i]].pb(i); } if (A>2)a={0, 1, 2}; else a={0, 1, 0, 0, 1, 1}; queue<int> q; vect[0]=0; q.push(0); while (q.size()){ int node=q.front(); q.pop(); for (auto id:graph[node]){ int num=u[id]^v[id]^node; if (res[id]==-1)res[id]=a[vect[node]]; if (vect[num]==-1){ if (graph[num].size()>2&&A==2)vect[num]=!a[vect[node]]; else vect[num]=(vect[node]+1)%a.size(); q.push(num); } } } return res; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second namespace{ int A, B, prev; bool lost; string s, a="010011010011"; } void Init(int a, int b){ A=a, B=b; prev=-1; lost=1; s=""; } int Move(vector<int> vect){ if (A>2){ if (!vect[0])return (vect[1]?1:2); if (!vect[1])return (vect[2]?2:0); return (vect[0]?0:1); } if (vect[0]+vect[1]>2){ lost=0; if (prev==-1)return prev=(vect[1]==1); if (!vect[prev])return -1; return prev=!prev; } else if (vect[0]+vect[1]==1){ lost=0; if (prev==-1)return prev=vect[1]; return -1; } else if (!lost)return prev=vect[1]; else{ for (int i=0; i<vect[0].size(); ++i)s.pb('0'); for (int i=0; i<vect[1].size(); ++i)s.pb('1'); if (s.size()==5){ lost=0; for (int i=0; i<6; ++i)if (s==a.substr(i, 5))return -1; } if (vect[0]&&vect[1])return prev=1; return prev=!!vect[1]; } }

Compilation message (stderr)

# 2번째 컴파일 단계

Catherine.cpp: In function 'void Init(int, int)':
Catherine.cpp:19:9: error: reference to 'prev' is ambiguous
   19 |         prev=-1;
      |         ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:32:21: error: reference to 'prev' is ambiguous
   32 |                 if (prev==-1)return prev=(vect[1]==1);
      |                     ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:32:37: error: reference to 'prev' is ambiguous
   32 |                 if (prev==-1)return prev=(vect[1]==1);
      |                                     ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:33:27: error: reference to 'prev' is ambiguous
   33 |                 if (!vect[prev])return -1;
      |                           ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:34:24: error: reference to 'prev' is ambiguous
   34 |                 return prev=!prev;
      |                        ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:34:30: error: reference to 'prev' is ambiguous
   34 |                 return prev=!prev;
      |                              ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:38:21: error: reference to 'prev' is ambiguous
   38 |                 if (prev==-1)return prev=vect[1];
      |                     ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:38:37: error: reference to 'prev' is ambiguous
   38 |                 if (prev==-1)return prev=vect[1];
      |                                     ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:41:31: error: reference to 'prev' is ambiguous
   41 |         else if (!lost)return prev=vect[1];
      |                               ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:43:41: error: request for member 'size' in 'vect.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   43 |                 for (int i=0; i<vect[0].size(); ++i)s.pb('0');
      |                                         ^~~~
Catherine.cpp:44:41: error: request for member 'size' in 'vect.std::vector<int>::operator[](1)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   44 |                 for (int i=0; i<vect[1].size(); ++i)s.pb('1');
      |                                         ^~~~
Catherine.cpp:49:45: error: reference to 'prev' is ambiguous
   49 |                 if (vect[0]&&vect[1])return prev=1;
      |                                             ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Catherine.cpp:50:24: error: reference to 'prev' is ambiguous
   50 |                 return prev=!!vect[1];
      |                        ^~~~
Catherine.cpp:12:19: note: candidates are: 'int {anonymous}::prev'
   12 |         int A, B, prev;
      |                   ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 from /usr/include/c++/11/vector:60,
                 from Catherine.h:4,
                 from Catherine.cpp:1:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~