Submission #363245

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3632452021-02-05 11:32:52teewarCats or Dogs (JOI18_catdog)C++14
Compilation error
0 ms0 KiB
#include "catdog.h"
using namespace std;
const int MAX = 1000;
const int INF = 1e9;
int d[MAX + 10][3];
vector<int> g[MAX + 10];
int best[MAX + 10];
int st[MAX + 10];
void dfs(int v, int p = -1) {
d[v][st[v]] = 0;
if(st[v] == 0) {
d[v][1] = d[v][2] = 0;
}
for(auto to: g[v]) {
if(p == to) {
continue;
}
dfs(to, v);
d[v][st[v]] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][st[v]]});
if(st[v] == 0) {
d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][1]});
d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][2]});
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

catdog.cpp: In function 'void dfs(int, int)':
catdog.cpp:25:80: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   25 |         d[v][st[v]] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][st[v]]});
      |                                                                                ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
catdog.cpp:25:80: note:   candidate expects 2 arguments, 1 provided
   25 |         d[v][st[v]] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][st[v]]});
      |                                                                                ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
catdog.cpp:25:80: note:   candidate expects 3 arguments, 1 provided
   25 |         d[v][st[v]] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][st[v]]});
      |                                                                                ^
catdog.cpp:27:76: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   27 |             d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][1]});
      |                                                                            ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
catdog.cpp:27:76: note:   candidate expects 2 arguments, 1 provided
   27 |             d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][1]});
      |                                                                            ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
catdog.cpp:27:76: note:   candidate expects 3 arguments, 1 provided
   27 |             d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][1]});
      |                                                                            ^
catdog.cpp:28:76: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   28 |             d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][2]});
      |                                                                            ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
catdog.cpp:28:76: note:   candidate expects 2 arguments, 1 provided
   28 |             d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][2]});
      |                                                                            ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
catdog.cpp:28:76: note:   candidate expects 3 arguments, 1 provided
   28 |             d[v][1] += min({d[to][0], d[to][1] + 1, d[to][2] + 1, d[to][2]});
      |                                                                            ^
catdog.cpp: In function 'int ans()':
catdog.cpp:41:43: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   41 |     return min({d[0][0], d[0][1], d[0][2]});
      |                                           ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
catdog.cpp:41:43: note:   candidate expects 2 arguments, 1 provided
   41 |     return min({d[0][0], d[0][1], d[0][2]});
      |                                           ^
In file included from /usr/include/c++/9/vector:60,
                 from catdog.h:3,
                 from catdog.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
catdog.cpp:41:43: note:   candidate expects 3 arguments, 1 provided
   41 |     return min({d[0][0], d[0][1], d[0][2]});
      |                                           ^