Submission #58959441


Source Code Expand

// #include <bits/allocator.h> // Temp fix for gcc13 global pragma
// #pragma GCC target("avx2,bmi2,popcnt,lzcnt")
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif
#ifdef LOCAL
	#include "Debug.h"
#else
	#define debug_endl() 42
	#define debug(...) 42
	#define debug2(...) 42
	#define debugbin(...) 42
#endif

template<class data_t, data_t _mod>
struct modular_fixed_base{
#define IS_INTEGRAL(T) (is_integral_v<T> || is_same_v<T, __int128_t> || is_same_v<T, __uint128_t>)
#define IS_UNSIGNED(T) (is_unsigned_v<T> || is_same_v<T, __uint128_t>)
	static_assert(IS_UNSIGNED(data_t));
	static_assert(1 <= _mod && _mod < data_t(1) << 8 * sizeof(data_t) - 1);
	static constexpr bool VARIATE_MOD_FLAG = false;
	static constexpr data_t mod(){
		return _mod;
	}
	template<class T>
	static vector<modular_fixed_base> precalc_power(T base, int SZ){
		vector<modular_fixed_base> res(SZ + 1, 1);
		for(auto i = 1; i <= SZ; ++ i) res[i] = res[i - 1] * base;
		return res;
	}
	template<class T>
	static vector<modular_fixed_base> precalc_geometric_sum(T base, int SZ){
		vector<modular_fixed_base> res(SZ + 1);
		for(auto i = 1; i <= SZ; ++ i) res[i] = res[i - 1] * base + base;
		return res;
	}
	static vector<modular_fixed_base> _INV;
	static void precalc_inverse(int SZ){
		if(_INV.empty()) _INV.assign(2, 1);
		for(auto x = _INV.size(); x <= SZ; ++ x) _INV.push_back(_mod / x * -_INV[_mod % x]);
	}
	// _mod must be a prime
	static modular_fixed_base _primitive_root;
	static modular_fixed_base primitive_root(){
		if(_primitive_root) return _primitive_root;
		if(_mod == 2) return _primitive_root = 1;
		if(_mod == 998244353) return _primitive_root = 3;
		data_t divs[20] = {};
		divs[0] = 2;
		int cnt = 1;
		data_t x = (_mod - 1) / 2;
		while(x % 2 == 0) x /= 2;
		for(auto i = 3; 1LL * i * i <= x; i += 2){
			if(x % i == 0){
				divs[cnt ++] = i;
				while(x % i == 0) x /= i;
			}
		}
		if(x > 1) divs[cnt ++] = x;
		for(auto g = 2; ; ++ g){
			bool ok = true;
			for(auto i = 0; i < cnt; ++ i){
				if(modular_fixed_base(g).power((_mod - 1) / divs[i]) == 1){
					ok = false;
					break;
				}
			}
			if(ok) return _primitive_root = g;
		}
	}
	constexpr modular_fixed_base(){ }
	modular_fixed_base(const double &x){ data = _normalize(llround(x)); }
	modular_fixed_base(const long double &x){ data = _normalize(llround(x)); }
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr> modular_fixed_base(const T &x){ data = _normalize(x); }
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr> static data_t _normalize(const T &x){
		int sign = x >= 0 ? 1 : -1;
		data_t v =  _mod <= sign * x ? sign * x % _mod : sign * x;
		if(sign == -1 && v) v = _mod - v;
		return v;
	}
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr> operator T() const{ return data; }
	modular_fixed_base &operator+=(const modular_fixed_base &otr){ if((data += otr.data) >= _mod) data -= _mod; return *this; }
	modular_fixed_base &operator-=(const modular_fixed_base &otr){ if((data += _mod - otr.data) >= _mod) data -= _mod; return *this; }
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr> modular_fixed_base &operator+=(const T &otr){ return *this += modular_fixed_base(otr); }
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr> modular_fixed_base &operator-=(const T &otr){ return *this -= modular_fixed_base(otr); }
	modular_fixed_base &operator++(){ return *this += 1; }
	modular_fixed_base &operator--(){ return *this += _mod - 1; }
	modular_fixed_base operator++(int){ modular_fixed_base result(*this); *this += 1; return result; }
	modular_fixed_base operator--(int){ modular_fixed_base result(*this); *this += _mod - 1; return result; }
	modular_fixed_base operator-() const{ return modular_fixed_base(_mod - data); }
	modular_fixed_base &operator*=(const modular_fixed_base &rhs){
		if constexpr(is_same_v<data_t, unsigned int>) data = (unsigned long long)data * rhs.data % _mod;
		else if constexpr(is_same_v<data_t, unsigned long long>){
			long long res = data * rhs.data - _mod * (unsigned long long)(1.L / _mod * data * rhs.data);
			data = res + _mod * (res < 0) - _mod * (res >= (long long)_mod);
		}
		else data = _normalize(data * rhs.data);
		return *this;
	}
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>
	modular_fixed_base &inplace_power(T e){
		if(e == 0) return *this = 1;
		if(data == 0) return *this = {};
		if(data == 1 || e == 1) return *this;
		if(data == mod() - 1) return e % 2 ? *this : *this = -*this;
		if(e < 0) *this = 1 / *this, e = -e;
		if(e == 1) return *this;
		modular_fixed_base res = 1;
		for(; e; *this *= *this, e >>= 1) if(e & 1) res *= *this;
		return *this = res;
	}
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>
	modular_fixed_base power(T e) const{
		return modular_fixed_base(*this).inplace_power(e);
	}
	// c + c * x + ... + c * x^{e-1}
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>
	modular_fixed_base &inplace_geometric_sum(T e, modular_fixed_base c = 1){
		if(e == 0) return *this = {};
		if(data == 0) return *this = {};
		if(data == 1) return *this = c * e;
		if(e == 1) return *this = c;
		if(data == mod() - 1) return *this = c * abs(e % 2);
		modular_fixed_base res = 0;
		if(e < 0) return *this = geometric_sum(-e + 1, -*this) - 1;
		if(e == 1) return *this = c * *this;
		for(; e; c *= 1 + *this, *this *= *this, e >>= 1) if(e & 1) res += c, c *= *this;
		return *this = res;
	}
	// c + c * x + ... + c * x^{e-1}
	template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>
	modular_fixed_base geometric_sum(T e, modular_fixed_base c = 1) const{
		return modular_fixed_base(*this).inplace_geometric_sum(e, c);
	}
	modular_fixed_base &operator/=(const modular_fixed_base &otr){
		make_signed_t<data_t> a = otr.data, m = _mod, u = 0, v = 1;
		if(a < _INV.size()) return *this *= _INV[a];
		while(a){
			make_signed_t<data_t> t = m / a;
			m -= t * a; swap(a, m);
			u -= t * v; swap(u, v);
		}
		assert(m == 1);
		return *this *= u;
	}
#define ARITHMETIC_OP(op, apply_op)\
modular_fixed_base operator op(const modular_fixed_base &x) const{ return modular_fixed_base(*this) apply_op x; }\
template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>\
modular_fixed_base operator op(const T &x) const{ return modular_fixed_base(*this) apply_op modular_fixed_base(x); }\
template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>\
friend modular_fixed_base operator op(const T &x, const modular_fixed_base &y){ return modular_fixed_base(x) apply_op y; }
	ARITHMETIC_OP(+, +=) ARITHMETIC_OP(-, -=) ARITHMETIC_OP(*, *=) ARITHMETIC_OP(/, /=)
#undef ARITHMETIC_OP
#define COMPARE_OP(op)\
bool operator op(const modular_fixed_base &x) const{ return data op x.data; }\
template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>\
bool operator op(const T &x) const{ return data op modular_fixed_base(x).data; }\
template<class T, typename enable_if<IS_INTEGRAL(T)>::type* = nullptr>\
friend bool operator op(const T &x, const modular_fixed_base &y){ return modular_fixed_base(x).data op y.data; }
	COMPARE_OP(==) COMPARE_OP(!=) COMPARE_OP(<) COMPARE_OP(<=) COMPARE_OP(>) COMPARE_OP(>=)
#undef COMPARE_OP
	friend istream &operator>>(istream &in, modular_fixed_base &number){
		long long x;
		in >> x;
		number.data = modular_fixed_base::_normalize(x);
		return in;
	}
#define _SHOW_FRACTION
	friend ostream &operator<<(ostream &out, const modular_fixed_base &number){
		out << number.data;
	#if defined(LOCAL) && defined(_SHOW_FRACTION)
		cerr << "(";
		for(auto d = 1; ; ++ d){
			if((number * d).data <= 1000000){
				cerr << (number * d).data;
				if(d != 1) cerr << "/" << d;
				break;
			}
			else if((-number * d).data <= 1000000){
				cerr << "-" << (-number * d).data;
				if(d != 1) cerr << "/" << d;
				break;
			}
		}
		cerr << ")";
	#endif
		return out;
	}
	data_t data = 0;
#undef _SHOW_FRACTION
#undef IS_INTEGRAL
#undef IS_UNSIGNED
};
template<class data_t, data_t _mod> vector<modular_fixed_base<data_t, _mod>> modular_fixed_base<data_t, _mod>::_INV;
template<class data_t, data_t _mod> modular_fixed_base<data_t, _mod> modular_fixed_base<data_t, _mod>::_primitive_root;

const unsigned int mod = (119 << 23) + 1; // 998244353
// const unsigned int mod = 1e9 + 7; // 1000000007
// const unsigned int mod = 1e9 + 9; // 1000000009
// const unsigned long long mod = (unsigned long long)1e18 + 9;
using modular = modular_fixed_base<decay_t<decltype(mod)>, mod>;
modular operator""_m(const char *x){ return stoll(x); }

template<class T, bool Force_Reduction = false>
struct field_of_fraction{
	T n, d;
	field_of_fraction(T n = 0, T d = 1): n(n), d(d){
		if(d < 0) this->n = -n, this->d = -d;
	}
	friend ostream &operator<<(ostream &out, const field_of_fraction &x){
		return out << x.n << "/" << x.d;
	}
	friend istream &operator>>(istream &in, field_of_fraction &x){
		in >> x.n, x.d = 1;
		return in;
	}
	field_of_fraction &reduce(){
		T g = gcd(n, d);
		n /= g, d /= g;
		return *this;
	}
	field_of_fraction reduced() const{
		return field_of_fraction(*this).reduce();
	}
	field_of_fraction &operator+=(const field_of_fraction &x){
		*this = {n * x.d + x.n * d, d * x.d};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator+=(const T &x){
		*this = {n + d * x, d};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator-=(const field_of_fraction &x){
		*this = {n * x.d - x.n * d, d * x.d};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator-=(const T &x){
		*this = {n - d * x, d};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator*=(const field_of_fraction &x){
		*this = {n * x.n, d * x.d};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator*=(const T &x){
		*this = {n * x, d};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator/=(const field_of_fraction &x){
		assert(x.n != T(0));
		*this = {n * x.d, d * x.n};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction &operator/=(const T &x){
		assert(x != T(0));
		*this = {n, d * x};
		if constexpr(Force_Reduction) this->reduce();
		return *this;
	}
	field_of_fraction operator+(const field_of_fraction &x) const{
		return field_of_fraction(*this) += x;
	}
	field_of_fraction operator+(const T &x) const{
		return field_of_fraction(*this) += x;
	}
	friend field_of_fraction operator+(const T &x, const field_of_fraction &f){
		return field_of_fraction(f) += x;
	}
	field_of_fraction operator+() const{
		return *this;
	}
	field_of_fraction operator-(const field_of_fraction &x) const{
		return field_of_fraction(*this) -= x;
	}
	field_of_fraction operator-(const T &x) const{
		return field_of_fraction(*this) -= x;
	}
	friend field_of_fraction operator-(const T &x, const field_of_fraction &f){
		field_of_fraction g = {x * f.d - f.n, f.d};
		if constexpr(Force_Reduction) g.reduce();
		return g;
	}
	field_of_fraction operator-() const{
		return {-n, d};
	}
	field_of_fraction operator*(const field_of_fraction &x) const{
		return field_of_fraction(*this) *= x;
	}
	field_of_fraction operator*(const T &x) const{
		return field_of_fraction(*this) *= x;
	}
	friend field_of_fraction operator*(const T &x, const field_of_fraction &f){
		return field_of_fraction(f) *= x;
	}
	field_of_fraction operator/(const field_of_fraction &x) const{
		return field_of_fraction(*this) /= x;
	}
	field_of_fraction operator/(const T &x) const{
		return field_of_fraction(*this) /= x;
	}
	friend field_of_fraction operator/(const T &x, const field_of_fraction &f){
		auto g = field_of_fraction(x * f.d, f.n);
		if constexpr(Force_Reduction) g.reduce();
		return g;
	}
	field_of_fraction &operator++(){
		n += d;
		return *this;
	}
	field_of_fraction operator++(int){
		auto res = *this;
		n += d;
		return res;
	}
	field_of_fraction &operator--(){
		n -= d;
		return *this;
	}
	field_of_fraction operator--(int){
		auto res = *this;
		n -= d;
		return res;
	}
#define OP(c)\
bool operator c(const field_of_fraction &x) const{\
	return n * x.d c x.n * d;\
}
OP(==) OP(!=) OP(<) OP(<=) OP(>) OP(>=)
#undef OP
#define OP(c)\
bool operator c(const T &x) const{\
	return n c d * x;\
}
OP(==) OP(!=) OP(<) OP(<=) OP(>) OP(>=)
#undef OP
#define OP(c)\
friend bool operator c(const T &x, const field_of_fraction &f){\
	return f.d * x c f.n;\
}
OP(==) OP(!=) OP(<) OP(<=) OP(>) OP(>=)
#undef OP
	explicit operator double() const{
		return 1.0 * n / d;
	}
	explicit operator long double() const{
		return 1.0l * n / d;
	}
	friend double sqrt(const field_of_fraction &f){
		return sqrt((double)f);
	}
	friend long double sqrtl(const field_of_fraction &f){
		return sqrtl((long double)f);
	}
	friend field_of_fraction abs(const field_of_fraction &f){
		return f < 0 ? -f : f;
	}
};
namespace std{
	template<class T> struct numeric_limits<field_of_fraction<T>>{
		static field_of_fraction<T> min(){ return {-1, 0}; };
		static field_of_fraction<T> max(){ return {1, 0}; };
	};
}

template<bool Enable_small_to_large = true>
struct disjoint_set{
#ifdef LOCAL
	#define ASSERT(x) assert(x)
#else
	#define ASSERT(x) 42
#endif
	int n, _group_count;
	vector<int> p;
	vector<list<int>> group;
	disjoint_set(){ }
	disjoint_set(int n): n(n), _group_count(n), p(n, -1), group(n){
		ASSERT(n >= 0);
		for(auto i = 0; i < n; ++ i) group[i] = {i};
	}
	int make_set(){
		p.push_back(-1);
		group.push_back(list<int>{n});
		++ _group_count;
		return n ++;
	}
	int root(int u){
		ASSERT(0 <= u && u < n);
		return p[u] < 0 ? u : p[u] = root(p[u]);
	}
	bool share(int u, int v){
		ASSERT(0 <= min(u, v) && max(u, v) < n);
		return root(u) == root(v);
	}
	int size(int u){
		ASSERT(0 <= u && u < n);
		return -p[root(u)];
	}
	bool merge(int u, int v){
		ASSERT(0 <= min(u, v) && max(u, v) < n);
		u = root(u), v = root(v);
		if(u == v) return false;
		-- _group_count;
		if constexpr(Enable_small_to_large) if(p[u] > p[v]) swap(u, v);
		p[u] += p[v], p[v] = u;
		group[u].splice(group[u].end(), group[v]);
		return true;
	}
	bool merge(int u, int v, auto act){
		ASSERT(0 <= min(u, v) && max(u, v) < n);
		u = root(u), v = root(v);
		if(u == v) return false;
		-- _group_count;
		bool swapped = false;
		if constexpr(Enable_small_to_large) if(p[u] > p[v]) swap(u, v), swapped = true;
		act(u, v, swapped);
		p[u] += p[v], p[v] = u;
		group[u].splice(group[u].end(), group[v]);
		return true;
	}
	int group_count() const{
		return _group_count;
	}
	const list<int> &group_of(int u){
		ASSERT(0 <= u && u < n);
		return group[root(u)];
	}
	vector<vector<int>> group_up(){
		vector<vector<int>> g(n);
		for(auto i = 0; i < n; ++ i) g[root(i)].push_back(i);
		g.erase(remove_if(g.begin(), g.end(), [&](auto &s){ return s.empty(); }), g.end());
		return g;
	}
	void clear(){
		_group_count = n;
		fill(p.begin(), p.end(), -1);
		for(auto i = 0; i < n; ++ i) group[i] = {i};
	}
	friend ostream &operator<<(ostream &out, disjoint_set dsu){
		auto gs = dsu.group_up();
		out << "{";
		if(!gs.empty()) for(auto i = 0; i < (int)gs.size(); ++ i){
			out << "{";
			for(auto j = 0; j < (int)gs[i].size(); ++ j){
				out << gs[i][j];
				if(j + 1 < (int)gs[i].size()) out << ", ";
			}
			out << "}";
			if(i + 1 < (int)gs.size()) out << ", ";
		}
		return out << "}";
	}
#undef ASSERT
};

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	using FF = field_of_fraction<long long>;
	auto __solve_tc = [&](auto __tc_num)->int{
		int n;
		cin >> n;
		vector<int> pv(n + 1, -1), a(n + 1);
		copy_n(istream_iterator<int>(cin), n, pv.begin() + 1);
		copy_n(istream_iterator<int>(cin), n, a.begin() + 1);
		disjoint_set<false> dsu(n + 1);
		vector<list<int>> res(n + 1);
		set<pair<FF, int>> s;
		vector<int> sum(n + 1);
		for(auto u = 0; u <= n; ++ u){
			res[u] = {u};
			if(u > 0){
				s.insert({FF{(int)res[u].size(), sum[u] = a[u]}, u});
			}
		}
		while(!s.empty()){
			int u = s.begin()->second;
			s.erase(s.begin());
			auto p = dsu.root(pv[u]);
			if(p){
				s.erase({FF{(int)res[p].size(), sum[p]}, p});
			}
			sum[p] += sum[u];
			dsu.merge(p, u);
			res[p].splice(res[p].end(), res[u]);
			if(p){
				s.insert({FF{(int)res[p].size(), sum[p]}, p});
			}
		}
		modular ans = 0;
		for(auto i = 0; auto u: res[0]){
			ans += 1LL * i * a[u];
			++ i;
		}
		cout << ans / sum[0] << "\n";
		return 0;
	};
	int __tc_cnt;
	cin >> __tc_cnt;
	for(auto __tc_num = 0; __tc_num < __tc_cnt; ++ __tc_num){
		__solve_tc(__tc_num);
	}
	return 0;
}

/*

*/

Submission Info

Submission Time
Task G - Treasure Hunting
User FlowerOfSorrow
Language C++ 23 (gcc 12.2)
Score 650
Code Size 17278 Byte
Status AC
Exec Time 276 ms
Memory 40584 KiB

Compile Error

Main.cpp: In instantiation of ‘struct modular_fixed_base<unsigned int, 998244353>’:
Main.cpp:206:35:   required from here
Main.cpp:24:75: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
   24 |         static_assert(1 <= _mod && _mod < data_t(1) << 8 * sizeof(data_t) - 1);
      |                                                        ~~~~~~~~~~~~~~~~~~~^~~
Main.cpp: In instantiation of ‘main()::<lambda(auto:55)> [with auto:55 = int]’:
Main.cpp:511:13:   required from here
Main.cpp:470:36: warning: unused parameter ‘__tc_num’ [-Wunused-parameter]
  470 |         auto __solve_tc = [&](auto __tc_num)->int{
      |                               ~~~~~^~~~~~~~
Main.cpp: In instantiation of ‘disjoint_set<Enable_small_to_large>::disjoint_set(int) [with bool Enable_small_to_large = false]’:
Main.cpp:476:23:   required from ‘main()::<lambda(auto:55)> [with auto:55 = int]’
Main.cpp:511:13:   required from here
Main.cpp:381:27: warning: statement has no effect [-Wunused-value]
  381 |         #define ASSERT(x) 42
      |                           ^~
Main.cpp:388:17: note: in expansion of macro ‘ASSERT’
  388 |                 ASSERT(n >= 0);
      |                 ^~~~~~
Main.cpp: In instantiation of ‘int disjoint_set<Enable_small_to_large>::root(int) [with bool Enable_small_to_large = false]’:
Main.cpp:489:21:   required from ‘main()::<lambda(auto:55)> [with auto:55 = int]’
Main.cpp:511:13:   required from here
Main.cpp:381:27: warning: statement has no effect [-Wunused-value]
  381 |         #define ASSERT(x) 42
      |                           ^~
Main.cpp:398:17: note: in expansion of macro ‘ASSERT’
  398 |                 ASSERT(0 <= u && u < n);
      |                 ^~~~~~
Main.cpp: In instantiation of ‘bool disjoint_set<Enable_small_to_large>::merge(int, int) [with bool Enable_small_to_large = false]’:
Main.cpp:494:13:   required from ‘main()::<lambda(auto:55)> [with auto:55 = int]’
Main.cpp:511:13:   required from here
Main.cpp:381:27: warning: statement has no effect [-Wunused-value]
  381 |         #define ASSERT(x) 42
      |                           ^~
Main.cpp:410:17: note: in expansion of macro ‘ASSERT’
  410 |                 ASSERT(0 <= min(u, v) && max(u, v) < n);
      |                 ^~~~~~
Main.cpp: In instantiation of ‘static data_t modular_fixed_base<data_t, _mod>::_normalize(const T&) [with T = int; typename std::enable_if<((is_integral_v<T> || is_same_v<T, __int128>) || is_same_v<T, __int128 unsigned>)>::type* <anonymous> = 0; data_t = unsigned int; data_t _mod = 998244353]’:
Main.cpp:78:122:   required from ‘modular_fixed_base<data_t, _mod>::modular_fixed_base(const T&) [with T = int; typename std::enable_if<((is_integral_v<T> || is_same_v<T, __int128>) || is_same_v<T, __int128 unsigned>)>::type* <anonymous> = 0; data_t = unsigned int; data_t _mod = 998244353]’
Main.cpp:500:11:   required from ‘main()::<lambda(auto:55)> [with auto:55 = int]’
Main.cpp:511:13:   required from here
Main.cpp:81:34: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
   81 |                 data_t v =  _mod <= sign * x ? sign * x % _mod : sign * x;
      |                             ~~~~~^~~~~~~~~~~
Main.cpp: In instantiation of ‘modular_fixed_base<data_t, _mod>& modular_fixed_base<data_t, _mod>::operator/=(const modular_fixed_base<data_t, _mod>&) [with data_t = unsigned int; data_t _mod = 998244353]’:
Main.cpp:156:65:   required from ‘modular_fixed_base<data_t, _mod> modular_fixed_base<data_t, _mod>::operator/(const T&) const [with T = int; typename std::enable_if<((is_integral_v<T> || is_same_v<T, __int128>) || is_same_v<T, __int128 unsigned>)>::type* <anonymous> = 0; data_t = unsigned int; data_t _mod = 998244353]’
Main.cpp:505:15:   required from ‘main()::<lambda(auto:55)> [with auto:55 = int]’
Main.cpp:511:13:   required from here
Main.cpp:141:22: warning: comparison of integer expressions of different signedness: ‘std::make_signed_t<unsigned int>’ {aka ‘int’} and ‘std::vector<modular_fixed_base<unsigned int, 998244353>, std::allocator<modular_fixed_base<unsigned int, 998244353> > >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  141 |                 if(a < _INV.size()) return *this *= _INV[a];
      |                    ~~^~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 650 / 650
Status
AC × 1
AC × 39
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_n_small_00.txt, 01_n_small_01.txt, 01_n_small_02.txt, 01_n_small_03.txt, 01_n_small_04.txt, 01_n_small_05.txt, 01_n_small_06.txt, 01_n_small_07.txt, 01_n_small_08.txt, 01_n_small_09.txt, 01_n_small_10.txt, 01_n_small_11.txt, 01_n_small_12.txt, 01_n_small_13.txt, 01_n_small_14.txt, 01_n_small_15.txt, 01_n_small_16.txt, 01_n_small_17.txt, 01_n_small_18.txt, 01_n_small_19.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 03_path_00.txt, 03_path_01.txt, 04_star_00.txt, 04_star_01.txt, 05_binary_00.txt, 05_binary_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3484 KiB
01_n_small_00.txt AC 60 ms 3408 KiB
01_n_small_01.txt AC 59 ms 3496 KiB
01_n_small_02.txt AC 59 ms 3480 KiB
01_n_small_03.txt AC 59 ms 3408 KiB
01_n_small_04.txt AC 59 ms 3420 KiB
01_n_small_05.txt AC 49 ms 3440 KiB
01_n_small_06.txt AC 51 ms 3492 KiB
01_n_small_07.txt AC 54 ms 3476 KiB
01_n_small_08.txt AC 50 ms 3440 KiB
01_n_small_09.txt AC 50 ms 3628 KiB
01_n_small_10.txt AC 54 ms 3496 KiB
01_n_small_11.txt AC 55 ms 3456 KiB
01_n_small_12.txt AC 54 ms 3628 KiB
01_n_small_13.txt AC 57 ms 3440 KiB
01_n_small_14.txt AC 73 ms 3508 KiB
01_n_small_15.txt AC 74 ms 3416 KiB
01_n_small_16.txt AC 74 ms 3648 KiB
01_n_small_17.txt AC 78 ms 3604 KiB
01_n_small_18.txt AC 86 ms 3596 KiB
01_n_small_19.txt AC 94 ms 3536 KiB
02_random_00.txt AC 106 ms 23936 KiB
02_random_01.txt AC 233 ms 40516 KiB
02_random_02.txt AC 200 ms 37204 KiB
02_random_03.txt AC 237 ms 40548 KiB
02_random_04.txt AC 161 ms 31560 KiB
02_random_05.txt AC 227 ms 40540 KiB
02_random_06.txt AC 188 ms 35216 KiB
02_random_07.txt AC 238 ms 40460 KiB
02_random_08.txt AC 128 ms 25688 KiB
02_random_09.txt AC 246 ms 40520 KiB
02_random_10.txt AC 137 ms 27384 KiB
02_random_11.txt AC 225 ms 40568 KiB
03_path_00.txt AC 168 ms 28640 KiB
03_path_01.txt AC 276 ms 40584 KiB
04_star_00.txt AC 68 ms 25852 KiB
04_star_01.txt AC 135 ms 40404 KiB
05_binary_00.txt AC 74 ms 27564 KiB
05_binary_01.txt AC 122 ms 40544 KiB