Submission #579486

# Submission time Handle Problem Language Result Execution time Memory
579486 2022-06-19T08:52:31 Z AriaH Jail (JOI22_jail) C++17
Compilation error
0 ms 0 KB
/* Ignore Others Only Focus On Yourself! */
/* Im the Best! */

#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

#define F first
#define S second
#define all(x) x.begin(),x.end()
#define Mp make_pair
#define point complex
#define endl '\n'
#define SZ(x) (int)x.size()
#define fast_io ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file_io freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define mashtali return cout << "Hello, World!", 0;

const int N = 1e6 + 10;
const int LOG = 20;
const ll mod = 1e9 + 7;
const ll inf = 8e18;
const double pi = acos(-1);
const ld eps = 1e-18;
const ld one = 1.;

ll pw(ll a, ll b, ll M, ll ret = 1) { if(a == 0) return 0; a %= M; while(b) { ret = (b & 1? ret * a % M : ret), a = a * a % M, b >>= 1; } return ret % M; }

mt19937 rng(time(nullptr));

int n, m, sub[N], H[N], P[N], Hd[N], Hv[N], S[N], T[N], start[N], end[N];

vector < int > G[N], adj[N], adt[N];

void dfs(int v)
{
	sub[v] = 1;
	H[v] = H[P[v]] + 1;
	for(auto u : G[v])
	{
		if(u == P[v]) continue;
		P[u] = v;
		dfs(u);
		if(sub[Hv[v]] < sub[u])
		{
			Hv[v] = u;
		}
	}
}

void Hld(int v)
{
	if(Hv[v])
	{
		Hd[Hv[v]] = Hd[v];
		dfs(Hv[v]);
	}
	for(auto u : G[v])
	{
		if(u == P[v] || u == Hv[v]) continue;
		Hd[u] = u;
		Hld(u);
	}
}

int main()
{
	fast_io;
	cin >> n;
	for(int i = 1; i < n; i ++)
	{
		int a, b;
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(1, 0);
	Hld(Hd[1] = 1);
	cin >> m;
	for(int i = 1; i <= m; i ++)
	{
		cin >> S[i] >> T[i];
		start[S[i]] = i;
		end[T[i]] = i;
	}
	for(int i = 1; i <= m; i ++)
	{
		vector < int > path;
		int v = S[i], u = T[i];
		while(v != )
	}
	return 0;
}

/* check corner case(n = 1?), watch for negetive index or overflow */

Compilation message

jail.cpp: In function 'int main()':
jail.cpp:84:10: error: too many arguments to function 'void dfs(int)'
   84 |  dfs(1, 0);
      |          ^
jail.cpp:42:6: note: declared here
   42 | void dfs(int v)
      |      ^~~
jail.cpp:91:3: error: reference to 'end' is ambiguous
   91 |   end[T[i]] = i;
      |   ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from jail.cpp:6:
/usr/include/c++/10/valarray:1244:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
/usr/include/c++/10/valarray:1234:5: note:                 'template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)'
 1234 |     end(valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from jail.cpp:6:
/usr/include/c++/10/bits/range_access.h:100:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  100 |     end(_Tp (&__arr)[_Nm])
      |     ^~~
/usr/include/c++/10/bits/range_access.h:81:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   81 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/10/bits/range_access.h:71:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   71 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
In file included from /usr/include/c++/10/bits/range_access.h:36,
                 from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from jail.cpp:6:
/usr/include/c++/10/initializer_list:101:5: note:                 'template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)'
  101 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
jail.cpp:38:67: note:                 'int end [1000010]'
   38 | int n, m, sub[N], H[N], P[N], Hd[N], Hv[N], S[N], T[N], start[N], end[N];
      |                                                                   ^~~
jail.cpp:97:14: error: expected primary-expression before ')' token
   97 |   while(v != )
      |              ^
jail.cpp:98:2: error: expected primary-expression before '}' token
   98 |  }
      |  ^
jail.cpp:96:17: warning: unused variable 'u' [-Wunused-variable]
   96 |   int v = S[i], u = T[i];
      |                 ^