QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#656818#9487. Vivid Colorsucup-team008#WA 2731ms4060kbC++2315.4kb2024-10-19 13:44:232024-10-19 13:44:23

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 13:44:23]
  • 评测
  • 测评结果:WA
  • 用时:2731ms
  • 内存:4060kb
  • [2024-10-19 13:44:23]
  • 提交

answer

// {{{ y0105w49 template 24K21
// hi mom
#ifndef NULL
#ifdef __GNUC__
#ifndef __clang__
// #include <bits/stdc++.h>
#include <bits/extc++.h>
#include <tr2/dynamic_bitset>
#define EXTS
#else
#ifdef ARST
#include <bits/clang++.h>
#else
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
// #include <cuchar>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif
#if __cplusplus >= 201703L
#include <any>
#include <charconv>
// #include <execution>
#include <filesystem>
#include <optional>
// #include <memory_resource>
#include <string_view>
#include <variant>
#endif
#if __cplusplus >= 202002L
#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#if __cpp_impl_coroutine
# include <coroutine>
#endif
#include <latch>
#include <numbers>
#include <ranges>
#include <span>
// #include <stop_token>
#include <semaphore>
// #include <source_location>
// #include <syncstream>
#include <version>
#endif
#if __cplusplus > 202002L
// #include <expected>
// #include <spanstream>
#if __has_include(<stacktrace>)
# include <stacktrace>
#endif
#include <stdatomic.h>
#endif
#endif
#endif
#else
#error "unsupported"
#endif
#endif
using namespace std;
#ifdef ARST
#define JO 1
#define OJ 0
#else
#define JO 0
#define OJ 1
#endif
#define STR(x) #x
#define GCCDIAG(s) _Pragma(STR(GCC diagnostic s)) static_assert(true)
#define Wsave GCCDIAG(push)
#define Wpop GCCDIAG(pop)
#define Wsupp(w) GCCDIAG(ignored "-W" w)
#define Wpush(w) Wsave; Wsupp(w)
#define typeof __typeof__
namespace gbd_ns {
	template<typename C> struct is_iterable {
		template<class T> static long check(...);
		template<class T> static char check(int,typename T::const_iterator = C().end());
		enum {
			value = sizeof(check<C>(0)) == sizeof(char),
			neg_value = sizeof(check<C>(0)) != sizeof(char)
		};
	};
	template<class T> struct _gbd3C;
	template<class T> ostream &_gbd3(ostream &os,const T &x) { return _gbd3C<T>::call(os,x); }
	template<> ostream &_gbd3(ostream &os,const string &x) { return os<<'"'<<x<<'"'; }
	template<> ostream &_gbd3(ostream &os,char *const &x) { return os<<'"'<<x<<'"'; }
	template<class T> ostream &_gbd3_5(ostream &os,const T &x) { return _gbd3(os,x); }
	template<class A,class B> ostream &_gbd4(ostream &os,const pair<A,B> &p) {
		_gbd3(os<<'(',p.first);
		_gbd3(os<<',',p.second);
		return os<<')';
	}
	template<class T,size_t N> struct _gbd4_tupleC {
		static void call(ostream &os,const T &t) {
			_gbd4_tupleC<T,N-1>::call(os,t);
			os<<','<<get<N-1>(t);
		}
	};
	template<class T> struct _gbd4_tupleC<T,1> {
		static void call(ostream &os,const T &t) { os<<get<0>(t); }
	};
	template<typename... Types> ostream &_gbd4(ostream &os,const tuple<Types...> &t) {
		os<<'(';
		_gbd4_tupleC<tuple<Types...>,sizeof...(Types)>::call(os,t);
		return os<<')';
	}
	template<> ostream &_gbd4(ostream &os,const tuple<> &t) { (void)t; return os<<"()"; }
	template<class T> ostream &_gbd4(ostream &os,const T &x) {
		return os<<x;
	}
	template<class T> struct _gbd3C {
		template<class U=T> static ostream &call(ostream &os,enable_if_t<is_iterable<U>::value,const T> &V) {
			os<<"{";
			bool ff=0;
			for(const auto &E:V) _gbd3_5<decltype(E)>(ff?os<<",":os,E), ff=1;
			return os<<"}";
		}
		template<class U=T> static ostream &call(ostream &os,enable_if_t<is_iterable<U>::neg_value,const T> &x) {
			return _gbd4(os,x);
		}
	};
	template<class T,typename... Args> ostream &_gbd2(ostream &os,bool,vector<string>::iterator nm,const T &x,Args&&... args);
	ostream &_gbd2(ostream &os,bool,vector<string>::iterator) { return os; }
	template<typename... Args> ostream &_gbd2(ostream &os,bool fi,vector<string>::iterator nm,const char *x,Args&&... args) {
		return _gbd2(os<<(fi?"":"  ")<<x,0,nm+1,args...);
	}
	template<class T,typename... Args> ostream &_gbd2(ostream &os,bool fi,vector<string>::iterator nm,const T &x,Args&&... args) {
		return _gbd2(_gbd3<T>(os<<(fi?"":"  ")<<*nm<<"=",x),0,nm+1,args...);
	}
	vector<string> split(string s) {
		vector<string> Z;
		string z="";
		s+=',';
		int dep=0;
		for(char c:s) {
			if(c==',' && !dep) Z.push_back(z),z="";
			else z+=c;
			if(c=='(' || c=='{' || c=='[') ++dep;
			if(c==')' || c=='}' || c==']') --dep;
		}
		return Z;
	}
	template<typename... Args> ostream &_gbd1(ostream &os,const string &nm,Args&&... args) {
		return _gbd2(os,1,split(nm).begin(),args...);
	}
	template<typename... Args> string _gbd1(const string &nm,Args&&... args) {
		ostringstream oss;
		_gbd2(oss,1,split(nm).begin(),args...);
		return oss.str();
	}
}
bool DBG=1,EMACS=0;
#define dbg(...) (JO&&DBG?gbd_ns::_gbd1(cerr<<"\033[38;5;5m"<<__FILE__<<":"<<__LINE__<<(EMACS?":note: ":": "),#__VA_ARGS__,__VA_ARGS__)<<"\033[0m"<<endl:cerr)
#define dbgt(...) dbg(fmt_time(),__VA_ARGS__)
#define fmt(...) gbd_ns::_gbd1(#__VA_ARGS__,__VA_ARGS__)
template<class Fun> struct _y_combinator_result {
	Fun _fun;
	template<class T> explicit _y_combinator_result(T &&fun) : _fun(forward<T>(fun)) {}
	template<typename... Args> decltype(auto) operator()(Args&&... args) {
		return _fun(ref(*this),forward<Args>(args)...);
	}
};
template<class Fun> [[nodiscard]] decltype(auto) fix(Fun &&fun) {
	return _y_combinator_result<decay_t<Fun>>(forward<Fun>(fun));
}
#define nop void()
#define sz(x) (int((x).size()))
#define all(v) (v).begin(),(v).end()
#define forenum(i,...) for(int i:{-1}) for(__VA_ARGS__) if(++i,0) assert(0); else
#define forenumll(i,...) for(long long i:{-1}) for(__VA_ARGS__) if(++i,0) assert(0); else
#define forbs(k,i,bs) for(ptrdiff_t k=0,i=(bs)._Find_first();i<(ptrdiff_t)(bs).size();i=(bs)._Find_next(i),++k)
#define fordbs(k,i,bs) for(ptrdiff_t k=0,i=(bs).find_first();i<(ptrdiff_t)(bs).size();i=(bs).find_next(i),++k)
#define get(x,i) get<i>(x)
template<class T> T &smin(T &x,const T &y) { return y<x?x=y:x; }
template<class T> T &smax(T &x,const T &y) { return y>x?x=y:x; }
template<class T> bool inb(const T &x,const T &l,const T &r) { return l<=x&&x<=r; }
template<class T> bool cinb(const T &x,const T &l,const T &r) { return l<=r?l<=x&&x<=r:l<=x||x<=r; }
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
template<template<class> class C,class T> T popv(C<T> &v) { T z=v.back(); v.pop_back(); return z; }
template<template<class> class C,class T> T popq(C<T> &v) { T z=v.top(); v.pop(); return z; }
template<template<class> class C,class T> T pops(C<T> &v) { T z=*v.begin(); v.erase(v.begin()); return z; }
template<template<class,class> class C,class K,class V> pair<K,V> popm(C<K,V> &v) { pair<K,V> z=*v.begin(); v.erase(v.begin()); return z; }
template<template<class> class C,class T> void erase1(C<T> &v,const T &x) { v.erase(v.find(x)); }
template<template<class> class C,class T> int lbi(C<T> &v,const T &x) { return int(lower_bound(all(v),x)-v.begin()); }
template<template<class> class C,class T> int findi(C<T> &v,const T &x) { auto it=lower_bound(all(v),x); return it!=v.end()&&*it==x?int(it-v.begin()):-1; }
template<class V> int sortu(V &v) { sort(all(v)); int z=int(unique(all(v))-v.begin()); v.resize(z); return z; }
template<typename T,typename... Args> T tee(T (*f)(Args... args),Args&&... args) { T z=f(forward<Args>(args)...); cout<<z<<endl; return z; }
template<typename... Args> void tee(void (*f)(Args... args),Args&&... args) { f(forward<Args>(args)...); }
#ifdef EXTS
template<class S,class T> using omap=__gnu_pbds::tree<S,T,less<S>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<class T> using oset=omap<T,__gnu_pbds::null_type>;
template<class T> using rope=__gnu_cxx::rope<T>;
using dbitset=tr2::dynamic_bitset<>;
#endif
constexpr int e0=1, e1=10, e2=100, e3=1000;
constexpr int e4=10*e3, e5=100*e3, e6=1000*e3;
constexpr int e7=10*e6, e8=100*e6, e9=1000*e6;
constexpr long long e10=10LL*e9, e11=100LL*e9, e12=1000LL*e9;
constexpr long long e13=10*e12, e14=100*e12, e15=1000*e12;
constexpr long long e16=10*e15, e17=100*e15, e18=1000*e15;
constexpr __int128_t e21=__int128_t(e3)*e18, e24=__int128_t(e6)*e18, e27=__int128_t(e9)*e18;
constexpr __int128_t e30=e3*e27, e33=e6*e27, e36=e9*e27;
using ulll=__uint128_t;
using lll=__int128_t;
using ull=unsigned long long;
using ll=long long;
using uint=unsigned int;
using ushort=unsigned short;
using uchar=char;
using ld=long double;
#ifdef EXTS
using lld=__float128;
#endif
long long START_TIME=chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now().time_since_epoch()).count();
inline long long now_U_03BC_s() { return chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now().time_since_epoch()).count()-START_TIME; }
const char *fmt_time(long long U_03BC_s=now_U_03BC_s()) { static char dur[20]; sprintf(dur,"%llu.%03llus",U_03BC_s/e6,(U_03BC_s%e6)/e3); return dur; }
#define timed(cb) do { dbg("timed "#cb" ..."); unsigned long long start=now_U_03BC_s(); cb; dbg("timed "#cb" took",fmt_time(now_U_03BC_s()-start)); } while(0)
int arg1; bool inp; vector<string> args;
unsigned seed=unsigned(JO&&getenv("sd")?atoi(getenv("sd")):OJ?START_TIME:START_TIME%e5);
mt19937 igen(seed<<1),gen(seed<<1|1);
#define irand(...) (assert(!inp),_rand(igen,__VA_ARGS__))
#define rand(...) _rand(gen,__VA_ARGS__)
template<class T> enable_if_t<numeric_limits<T>::is_integer,T> _rand(mt19937 &g,T l,T r) { return uniform_int_distribution<T>(l,r)(g); }
template<class T> enable_if_t<numeric_limits<T>::is_integer,T> _rand(mt19937 &g,T n) { return _rand(g,T(1),n); }
[[deprecated]] int _rand(mt19937 &g) { return _rand(g,0,numeric_limits<int>::max()); }
template<class T> enable_if_t<numeric_limits<T>::is_iec559,T> _rand(mt19937 &g,T l,T r) { return uniform_real_distribution<T>(l,r)(g); }
bool _rand(mt19937 &g,double p) { return bernoulli_distribution(p)(g); }
template<class T> T _rand(mt19937 &g,initializer_list<T> il) { return *(il.begin()+_rand(g,0,(int)il.size()-1)); }
template<class T> T _rand(mt19937 &g,double p,T a,T b) { return _rand(g,p)?a:b; }
template<class T> T _rand(mt19937 &g,initializer_list<T> il,initializer_list<double> wt) { assert(il.size()==wt.size()); return *(il.begin()+discrete_distribution<int>(wt)(g)); }
#define random_shuffle(...) static_assert(false,"random_shuffle deprecated, use shuffle")
#define ine(x,e) (inp?cin>>(x),nop:((x)=(e),nop))
#define inr(x,...) ine(x,irand(__VA_ARGS__))
#define endl '\n'
string garb;
void exit0() { DBG=1; dbgt("gg (early)",seed); exit(0); }
#ifndef MAIN
#define MAIN _main
#endif
void MAIN();
int32_t main([[maybe_unused]]int argc,[[maybe_unused]]char *argv[]) {
	ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(ios_base::failbit | ios_base::badbit);
	arg1=0,args={argv,argv+argc};
	if(sz(args)>1) {
		if(args[1][0]=='i') freopen((string(__FILE__).substr(0,string(__FILE__).find('.'))+"."+args[1].substr(1)+".in").c_str(),"r",stdin);
		else if(args[1][0]=='I') freopen(args[1].substr(1).c_str(),"r",stdin);
		else arg1=stoi(args[1]);
	}
	inp=!arg1;
	if(JO && getenv("EMACS")) EMACS=1;
	dbgt(arg1,seed,args);
	#ifdef QUIET
	DBG=0;
	#endif
	MAIN();
	DBG=1;
	dbgt("gg;wp",seed);
	return 0;
}
constexpr int inf=e9+99;
constexpr ll linf=1LL*e9*e9+99;
#if __cplusplus >= 202002L
constexpr long double U_03C4__ld=2*numbers::pi_v<long double>;
#else
const long double U_03C4__ld=2*acosl(-1);
#endif
#define U_03C4_ ((flt)U_03C4__ld)
constexpr long double U_03B5__ld=1e-8l;
#define U_03B5_ ((flt)U_03B5__ld)
// }}}
using flt=double; //CARE
constexpr int P=998'244'353;

int powq(int x,int e) {
	int z=1;
	for(;e;e>>=1,x=int(1LL*x*x%P)) if(e&1) z=int(1LL*z*x%P);
	return z;
}
#define inv(x) powq(x,P-2)
template<class T> int sgn(T x) { return int(x>0)-int(x<0); }



auto solve() { /* CURSOR START */
	int n; ine(n,arg1);
	vector<array<int,4>> a(n);
	forenum(ii,auto &[i,x,y,z]:a) {
		i=ii+1;
		inr(x,2*e5), inr(y,2*e5), inr(z,2*e5);
		int s=x+y+z;
		x*=3, y*=3, z*=3;
		x-=s, y-=s, z-=s;
	}
	if(n<10) dbg(a);

	vector<ll> ans(n+1,0);

	for(auto bigloop:{0,1})
	for(auto [i0,x0,y0,z0]:a) {
		vector<array<int,4>> evts;
		ll X=0,Y=0,Z=0;
		int cc=0;
		for(auto [i,x,y,z]:a) {
			if(x==x0 && y==y0 && z==z0) {
				if(i>=i0) X+=x,Y+=y,Z+=z,++cc;
				dbg("adding?",i>=i0,i,i0,x,y,z);
				continue;
			}
			assert(x!=x0 || y!=y0);
			if(y<y0 || (y==y0 && x<x0)) X+=x,Y+=y,Z+=z,++cc;
			dbg("and real?",y<y0 || (y==y0 && x<x0),i,i0,x,y,z);
			evts.pb({i,x,y,z});
			evts.pb({-i,x,y,z});
		}

		sort(all(evts),[&](auto lef,auto rig) -> bool {
			auto [il,xl,yl,zl]=lef; xl-=x0, yl-=y0, zl-=z0;
			if(il<0) xl=-xl,yl=-yl,zl=-zl;
			auto [ir,xr,yr,zr]=rig; xr-=x0, yr-=y0, zr-=z0;
			if(ir<0) xr=-xr,yr=-yr,zr=-zr;
			assert(xr||yr);
			assert(xl||yl);
			// if(!xr && !yr) return 0;
			// if(!xl && !yl) return 1;
			// if(!yl && !yr && sgn(il)!=sgn(ir)) return il<ir;
			if(!yl && !yr && sgn(xl)==sgn(xr)) return bigloop?il<ir:il>ir;
			if(!yl && !yr) return xl>xr;
			if(!yl && xl>0) return 1;
			if(!yl) return yr<0;
			if(!yr && xr>0) return 0;
			if(!yr) return yl>0;

			assert(sgn(yl)&&sgn(yr));
			if(sgn(yl)!=sgn(yr)) return sgn(yl)>sgn(yr);
			return 1LL*yl*zr+1LL*zl*xr+1LL*xl*yr>1LL*yr*zl+1LL*zr*xl+1LL*xr*yl;
		});
		if(i0==1 && n<10) dbg(i0,x0,y0,z0,X,Y,Z,evts);

		for(auto [i,x,y,z]:evts) {
			if(i>0) X+=x,Y+=y,Z+=z,++cc;
			else X-=x,Y-=y,Z-=z,--cc;
			// else X-=2*x0-x,Y-=2*y0-y,Z-=2*z0-z,--cc;
			smax(ans[cc],X*X+Y*Y+Z*Z);
			dbg(i0,i,x,y,z,cc,X,Y,Z);
		}

		// for(int j=1)
	}

	for(int i=1;i<=n;i++) cout<<1LL*ans[i]%P*inv(int(27LL*i*i%P))%P<<endl;
	return;

	vector<ll> ans2(n+1,0);
	for(int mk=1<<n;~--mk;) {
		ll X=0,Y=0,Z=0;
		for(auto [i,x,y,z]:a) if(mk<<1&1<<i) X+=x,Y+=y,Z+=z;
		smax(ans2[popcount((uint)mk)],X*X+Y*Y+Z*Z);
	}
	for(int i=1;i<=n;i++) cout<<1LL*ans2[i]%P*inv(int(27LL*i*i%P))%P<<endl;
	for(int i=1;i<=n;i++) assert(ans[i]==ans2[i]);
}



void _main() { int NTC=1;
	// ine(NTC,5);
	for(int TC=1;TC<=NTC;TC++) {
		// cout<<"Case #"<<TC<<": ";
		tee(solve);
	}
	if(JO&&inp) assert((cin>>ws).eof());
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3592kb

input:

3
180 0 0
0 180 180
0 0 180

output:

7200
5400
800

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

6
30594 32322 46262
63608 59020 98436
90150 32740 67209
82886 4627 54813
3112 67989 74995
60872 9967 9051

output:

715162883
838096208
930330061
405079896
880764907
526006962

result:

ok 6 tokens

Test #3:

score: 0
Accepted
time: 10ms
memory: 3664kb

input:

144
41472 41434 41317
16965 16900 17440
65702 65688 65497
15829 15900 15359
186620 186555 186425
22130 22030 22145
22995 23022 23320
54430 54525 54770
145816 145739 146046
106008 106083 106073
84481 84531 84306
162468 162563 162313
144375 144342 144210
68596 68548 68201
124014 124100 123649
137878 1...

output:

665561664
166436731
579289313
55518246
226327601
523827415
697242492
166428961
72628719
361639205
499632513
554631323
305233223
309029649
197725655
853581515
286740033
873681088
443094922
905119354
107690174
499165266
848371940
176043988
31275150
39747201
676490856
965461580
788056873
59932649
12538...

result:

ok 144 tokens

Test #4:

score: 0
Accepted
time: 43ms
memory: 3688kb

input:

282
94428 97009 94455
188420 188507 188612
93867 96593 93723
39525 41816 39549
192460 192576 192433
3845 1235 4121
11984 12390 12173
130725 130116 130896
87196 88124 87364
44538 45060 44298
166342 166632 166330
82059 84785 81813
27313 29691 27187
34038 35140 33798
54607 52867 54514
133483 131946 133...

output:

889314432
390117563
692023566
98907387
121626305
562561437
943457514
32985591
579638100
443215860
190588508
100335990
245223619
297117655
983188143
829225394
24317883
294014511
13323940
161909823
702330540
380190451
641303019
179896717
251619007
656550638
566922194
280229585
194457893
858751625
3209...

result:

ok 282 tokens

Test #5:

score: 0
Accepted
time: 39ms
memory: 3912kb

input:

271
153127 153535 152737
23323 22899 22765
34658 35090 35102
105004 105460 105508
137353 137025 137455
123997 123645 123883
11813 12333 11387
144072 144184 144198
190834 190866 191008
134203 134619 133837
160912 160400 161494
120883 121563 120775
183341 182637 183593
111598 112254 111034
34566 35078...

output:

322344
554885983
764388094
286496
120066627
542525190
428080325
887579586
216597238
807704248
412727458
450051205
289652425
201676353
851555207
107659595
407794390
845083057
11262308
601363802
380228455
744523302
119075663
10973283
784763125
915078500
635553912
194849886
439358978
606025095
61708067...

result:

ok 271 tokens

Test #6:

score: 0
Accepted
time: 28ms
memory: 3624kb

input:

300
104842 113680 113680
143955 136043 136043
29866 29080 29080
109288 101080 101080
172820 180722 180722
125104 118195 118195
24448 26967 26967
77313 70147 70147
24553 20285 20285
53114 43843 43843
42094 36323 36323
128136 118936 118936
71217 79147 79147
121620 123061 123061
100792 97508 97508
6721...

output:

909461736
22044800
21938688
909191994
381166451
767341949
684892751
794542288
656904216
460707595
108474983
919416671
87517565
286000639
180810310
793966736
508746481
257745719
464727415
117705770
19553070
874340280
950689183
651506248
866529385
679037134
681710885
712583626
879201340
547702999
5130...

result:

ok 300 tokens

Test #7:

score: 0
Accepted
time: 29ms
memory: 3720kb

input:

300
182375 34340 31299
189896 7463 82920
175804 33229 17728
172428 38589 3152
179561 2042 66285
185751 10962 68975
194517 7716 93141
179439 7380 59163
199426 4435 108550
173662 1057 54086
194638 70081 13462
178554 31065 26778
170726 851 47650
182300 49007 12324
185665 62746 2389
188363 25586 56187
1...

output:

723410220
723410220
723410220
768126446
968000807
978289779
686716556
300986523
23685666
100863542
817903116
368292549
966551585
815525412
775319408
530137969
106128595
713413782
14090737
580333162
736583094
17911566
818088391
284054642
161362307
515282086
487513444
432115986
582112009
211599028
776...

result:

ok 300 tokens

Test #8:

score: 0
Accepted
time: 28ms
memory: 3668kb

input:

300
152843 194847 111534
143276 172558 89245
60327 105984 22671
128676 175881 92568
121633 166382 83069
105658 145368 62055
124729 163074 79761
106430 139071 55758
102353 144000 60687
106582 145138 61825
135534 170455 87142
132677 175622 92309
87838 124176 40863
127763 162661 79348
57824 87301 3988
...

output:

199685421
254923155
408725470
573435441
993166600
778057960
402409983
198533293
620160445
757271783
45914347
559925318
333601004
636739495
779637954
910451416
197133729
719355632
138699036
711225505
662430730
816748658
118604432
106049642
217966163
21164675
626881354
798024734
61816036
866368325
961...

result:

ok 300 tokens

Test #9:

score: 0
Accepted
time: 2703ms
memory: 3824kb

input:

2000
46852 76871 93555
109329 4592 117118
85100 78035 166719
9336 156179 29277
93649 191864 9597
139268 193640 103865
65176 45936 22032
140243 24791 33044
190522 37917 165916
129355 113010 72009
90540 120070 180615
161806 63989 192069
137247 149177 120171
10653 20063 85613
97726 10036 38469
159738 1...

output:

667500967
561870818
227733218
708027088
503022645
936956883
568087276
65695301
103966866
777260851
400197479
712392592
452503693
262345617
470045142
723034628
398361563
708274989
151258829
5630611
826259002
935693539
63404055
561026681
692615880
774294332
215173128
420114593
376847155
640103994
5242...

result:

ok 2000 tokens

Test #10:

score: 0
Accepted
time: 2731ms
memory: 3828kb

input:

2000
170443 63953 136369
36312 172296 147102
198446 4587 74632
805 90356 106816
173954 30881 37344
182227 148443 159909
113809 89480 7848
143983 38598 106491
154799 94036 142737
177354 38433 113808
173255 69740 24509
144340 100252 150185
99168 90365 106672
165243 19085 56788
3914 147270 126334
11166...

output:

519115744
20818054
931919121
448166710
802187150
689436348
610737054
740967480
769405418
701919817
459762192
432304172
890249278
39760968
141835491
539733077
810070250
739548110
458211345
786753372
812644098
734265883
136199485
708252127
249368949
192021567
285711977
861514987
375908285
781237155
87...

result:

ok 2000 tokens

Test #11:

score: 0
Accepted
time: 2683ms
memory: 3820kb

input:

2000
196942 112774 23684
96132 165902 76519
118059 174498 64568
22530 170567 87637
101144 98454 62759
153297 127754 148923
48742 93603 90889
30327 26545 99570
76068 64513 102993
177954 160810 11164
173021 35133 133184
62910 123610 127443
47634 119782 7385
41525 142790 155844
110578 170434 99145
1074...

output:

821579100
641206285
296714257
950855688
393837213
625996113
508099897
946995812
504794481
983069553
266719552
830096464
756046928
282496973
179500990
387833567
375945004
247460194
961546870
486390248
530257362
970875424
517167023
102172769
798700912
315152832
167295601
676740822
124655295
255302607
...

result:

ok 2000 tokens

Test #12:

score: 0
Accepted
time: 2710ms
memory: 4020kb

input:

2000
83607 87014 144847
84715 90303 129233
97538 155282 149989
80232 182943 5467
142798 199114 72943
48908 150972 193087
173 109865 158005
112702 148488 167151
12802 180740 78128
94184 40167 136268
159314 142402 112499
3872 98897 17479
190811 12706 101844
86916 110199 120507
63069 61218 118580
19821...

output:

782855787
110218100
809446918
46399567
987431977
587687567
131850149
448361738
892167606
341673483
247030283
67284518
737363184
393422331
344880323
731709131
35570695
32869364
703558419
428702433
912114290
645778415
209818018
615952680
797880149
743607083
707491855
579867883
620473029
777014131
6511...

result:

ok 2000 tokens

Test #13:

score: 0
Accepted
time: 2694ms
memory: 3800kb

input:

2000
110222 156207 11992
91886 164550 9223
173234 154982 100089
87574 104925 198900
145962 140588 198879
42024 99665 125470
46162 137364 8984
3153 125610 40916
187311 127998 41049
465 189792 167331
145221 29428 176483
175312 76122 117290
40458 165746 50634
120088 55254 92197
110093 74112 4651
122187...

output:

850421237
165579435
381628722
37256930
936151141
790815877
940851854
556404342
896242125
994825793
934244039
856116956
728097755
381250556
300879456
371172798
962959386
527517555
214758225
935229466
925079984
431884920
399624072
560442420
711431461
39554015
502166206
885547344
583244425
665042385
38...

result:

ok 2000 tokens

Test #14:

score: 0
Accepted
time: 2444ms
memory: 3828kb

input:

1910
116449 116505 116653
15080 15080 14831
74284 74252 74419
111807 111583 111684
57104 57412 57290
170401 170209 170539
75454 75566 75208
92202 91986 92097
101155 101399 101440
40361 40505 40553
1268 1320 1115
91224 91108 91275
84071 84183 84014
28490 28126 28538
141584 141672 141542
63790 63954 6...

output:

887410536
499201647
468390712
429877677
439305099
838108486
387149315
315491413
985993266
315073599
763650337
787266365
54543523
782140636
654719978
328483879
234565245
338977770
905830438
20031907
471397020
185690391
732028155
579294045
247452666
543488142
756697861
886261061
834506321
295100625
81...

result:

ok 1910 tokens

Test #15:

score: 0
Accepted
time: 1248ms
memory: 3800kb

input:

1382
149836 149822 149806
98176 98079 98276
16369 16408 16430
161298 161291 161323
168221 168155 168266
1607 1524 1683
4524 4475 4520
67387 67315 67441
185186 185274 185133
164468 164410 164560
178259 178176 178191
194509 194435 194541
19595 19579 19505
159548 159504 159459
84559 84637 84654
132785 ...

output:

665502902
887334848
628530539
596179839
168598384
720960177
991459430
13870302
602512632
845185917
620585471
961277942
588713767
164115987
920855090
481796998
796374907
137623442
825884350
859050061
30941075
158587717
353301143
702858600
981567781
747211746
306127332
247868519
34031664
718248055
607...

result:

ok 1382 tokens

Test #16:

score: 0
Accepted
time: 629ms
memory: 3916kb

input:

1000
81054 81128 81002
166650 166516 166697
98097 98253 98128
3315 3335 3267
2645 2737 2557
14753 14677 14784
59851 59769 59760
67967 68147 67963
160563 160631 160464
173452 173536 173398
23214 23098 23283
92147 92037 92171
113694 113838 113760
172232 172144 172169
163544 163370 163512
48588 48588 4...

output:

554595223
221846780
295790698
55472559
940582444
24662362
896396932
856147255
877756905
893997057
142096173
720967784
129962350
682486408
247972063
775558714
102101672
241015510
966917851
867375990
156703401
702633446
623784031
873861223
643147782
650741448
925225281
138374091
823243682
730578820
50...

result:

ok 1000 tokens

Test #17:

score: 0
Accepted
time: 1655ms
memory: 3988kb

input:

2000
156741 146881 146881
99950 107879 107879
157059 148825 148825
10891 13215 13215
44539 51026 51026
36388 38203 38203
134774 133471 133471
140086 132182 132182
108884 114833 114833
121242 123564 123564
199398 199322 199322
127241 132177 132177
174168 165099 165099
172465 180872 180872
143392 1438...

output:

244032084
410359524
564382222
243952196
660984976
527365883
488351840
895492012
576589597
261567704
356551855
217590722
168936040
358045305
461110597
506256749
373787423
729096441
820967449
549759711
9454529
82714195
225324035
882852024
64106031
314384486
859067842
315600189
499807660
263604293
5014...

result:

ok 2000 tokens

Test #18:

score: 0
Accepted
time: 1653ms
memory: 4060kb

input:

2000
18300 57191 190295
12158 137354 65253
18791 61050 186146
70332 146271 191287
85377 197522 156452
24460 177863 38695
33379 139630 112574
17856 53379 194491
78128 155751 196763
42260 104306 182355
42286 110226 174261
73723 172396 163358
73641 192943 134856
52473 114098 193148
3572 27307 196447
46...

output:

25254561
25254561
25254561
25254561
305218667
299614421
384800604
825014522
355193740
239867203
987498480
359277577
959362450
692178032
279777802
850821223
842347399
348400937
896732248
528022465
771015067
752685674
267120432
713085481
917831744
832099950
982482304
922682018
938878966
78290683
91299...

result:

ok 2000 tokens

Test #19:

score: 0
Accepted
time: 1648ms
memory: 3764kb

input:

2000
182291 42889 186548
186766 45842 189501
195575 46743 190402
182587 34032 177691
151093 13138 156797
160998 12286 155945
186735 34378 178037
165416 29135 172794
196044 48771 192430
195004 40885 184544
193554 52895 196554
188824 49596 193255
188146 42460 186119
167338 21863 165522
174506 37071 18...

output:

510472346
122247906
793826833
621205363
669927894
676462071
842744629
589639641
541226869
343164990
595537232
390575931
707897925
950288829
2967920
227863535
985541793
9209505
667651189
840805465
475977947
367072176
273646130
920283667
423648899
758050074
45633855
238051170
752059829
756822578
64486...

result:

ok 2000 tokens

Test #20:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

10
0 0 200000
100000 0 200000
100000 0 200000
0 0 200000
200000 200000 0
200000 0 0
200000 200000 0
200000 0 200000
0 0 200000
100000 0 200000

output:

459269908
459269908
459269908
596208078
146208078
123595712
374197620
778441137
462607578
979143281

result:

ok 10 tokens

Test #21:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

30
20202 183160 117360
102695 23158 13538
10110 173068 107268
4817 167775 101975
145646 66109 56489
179930 4341 18909
16151 179109 113309
29146 192104 126304
6699 169657 103857
1361 63430 28854
99909 20372 10752
99791 184495 195232
26741 189699 123899
78083 127382 20214
38599 176716 12280
124280 447...

output:

562531070
562531070
562531070
209688629
111968436
43872512
43872512
43872512
43872512
922560746
137748221
508796019
91639026
117080583
707790124
928629583
231973873
474963192
46412700
284588347
343866886
254578930
581705385
376773694
849470566
402564046
230979911
936492416
789870295
260124876

result:

ok 30 tokens

Test #22:

score: 0
Accepted
time: 6ms
memory: 3668kb

input:

155
146635 186686 2719
60847 35024 186006
56120 116063 167445
192132 32460 181465
157404 197455 13488
27965 2142 153124
58176 118119 169501
150432 190483 6516
37171 97114 148496
35112 95055 146437
19265 197223 146962
50324 110267 161649
76278 136221 187603
2474 180432 130171
156200 196251 12284
1566...

output:

472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
472338710
...

result:

ok 155 tokens

Test #23:

score: 0
Accepted
time: 446ms
memory: 3760kb

input:

1147
200000 200000 0
0 200000 0
0 0 200000
200000 200000 0
200000 200000 0
0 200000 0
0 200000 0
200000 0 200000
200000 0 200000
100000 200000 0
200000 0 200000
200000 0 200000
200000 0 0
0 200000 0
200000 200000 0
200000 0 200000
0 200000 0
200000 0 200000
200000 0 0
100000 0 200000
200000 0 200000...

output:

459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
459269908
...

result:

ok 1147 tokens

Test #24:

score: 0
Accepted
time: 1128ms
memory: 3792kb

input:

1911
132757 24041 12803
184362 75022 55237
164872 56440 136824
162636 53296 33511
6312 107723 44083
96124 197535 133895
141708 32368 12583
194053 84713 64928
79839 181250 117610
111485 3053 83437
90075 191486 127846
52075 153486 89846
130701 21361 1576
182080 72740 52955
169072 60640 141024
21942 12...

output:

128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
128461641
...

result:

ok 1911 tokens

Test #25:

score: 0
Accepted
time: 483ms
memory: 3784kb

input:

1267
91713 102012 162268
118610 128909 189165
14079 24378 84634
79453 89658 199717
156872 198765 11561
140964 1164 157087
179342 173699 17169
193598 187955 31425
9922 20221 80477
7887 18186 78442
48456 58661 168720
10489 20788 81044
70682 80887 190946
3052 13351 73607
168991 29191 185114
39111 49316...

output:

334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
334689819
...

result:

ok 1267 tokens

Test #26:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

2
6556 194393 72097
64196 58513 36579

output:

957270292
763048903

result:

ok 2 tokens

Test #27:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

2
177392 194161 142964
22790 154794 110604

output:

902496445
669436299

result:

ok 2 tokens

Test #28:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

2
7811 24561 57314
60990 132475 157815

output:

571650880
960238449

result:

ok 2 tokens

Test #29:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

2
147127 52124 187700
170363 183848 142853

output:

122416470
493274460

result:

ok 2 tokens

Test #30:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

8
57787 117757 154472
72926 1703 198916
41853 183013 110785
89194 72842 40758
56443 88236 26793
24312 99595 25353
94104 90165 158263
69342 11390 191294

output:

215665636
298537043
824400151
203976991
658402539
828528475
697146074
434476186

result:

ok 8 tokens

Test #31:

score: 0
Accepted
time: 49ms
memory: 3664kb

input:

300
120435 140568 32722
99230 20656 144714
76854 164794 162141
94800 151349 50407
184699 18233 12012
173346 59742 75861
20916 61024 26476
99647 72869 118858
166640 95638 42638
97040 93132 54921
175682 69986 183977
179187 169878 18717
159680 166455 44862
140021 191136 64175
42834 121178 99471
70765 1...

output:

455061855
54017169
80792773
965412473
703712612
301195650
214581923
426837627
717248231
612782084
697726316
900344528
617675349
406377208
636012252
620792667
710055507
365747294
274003937
14054467
972680478
787751165
990653784
504974293
955982495
792506791
280643512
273110753
259071822
892527478
485...

result:

ok 300 tokens

Test #32:

score: 0
Accepted
time: 51ms
memory: 3848kb

input:

300
82719 31340 194741
140473 199803 180922
48535 50211 56723
193620 126929 72482
189945 154556 199283
137530 156445 74186
26352 50886 77659
59633 94602 47039
79237 3708 185602
140020 33182 71909
11931 14293 145059
76581 182823 33103
167213 197339 128680
26892 3215 150487
74537 123049 125492
115466 ...

output:

773153416
963385731
471757267
439658912
622415736
427829911
294380777
247319497
155579862
255655203
249509554
427265335
414266563
680403458
172946130
703156797
823601045
131128483
588711240
337720211
17811755
738790586
810582620
420657526
300906184
575415527
204652699
252628412
926069774
816076589
4...

result:

ok 300 tokens

Test #33:

score: 0
Accepted
time: 49ms
memory: 3660kb

input:

300
195508 89001 58083
87311 44074 20022
133820 165996 29891
139094 133680 50830
91586 92038 190678
169199 38716 61936
26949 38389 67100
51713 45481 157915
40073 199285 199007
171837 19753 46437
164613 129529 121622
197773 147779 199197
151904 117677 178555
147978 168556 166539
163714 84727 164421
8...

output:

76589657
194094839
412539464
455865425
67516399
446296275
662704604
649689078
860683041
688444244
38481783
118381838
293448978
353130006
132568232
622661089
354624751
972917858
495934019
940922394
214918370
669238176
71150842
591377055
303610770
983363191
799070353
774529739
107638346
893771009
7547...

result:

ok 300 tokens

Test #34:

score: -100
Wrong Answer
time: 0ms
memory: 3600kb

input:

141
38715 31363 164126
39131 31779 164542
14005 6653 139416
36931 29579 162342
37870 30518 163281
14232 6880 139643
20485 13133 145896
61524 54172 186935
50644 43292 176055
69270 61918 194681
20530 13178 145941
25370 18018 150781
8031 679 133442
28053 20701 153464
60686 53334 186097
69702 62350 1951...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

wrong answer 1st words differ - expected: '384517156', found: '0'