QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#273695#7883. Takeout Deliveringucup-team008#TL 454ms80868kbC++2312.5kb2023-12-03 03:08:082023-12-03 03:08:09

Judging History

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

  • [2023-12-03 03:08:09]
  • 评测
  • 测评结果:TL
  • 用时:454ms
  • 内存:80868kb
  • [2023-12-03 03:08:08]
  • 提交

answer

// {{{ y0105w49 template 22M14
// 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 sortu(v) (sort(all(v)), (v).resize(unique(all(v))-begin(v)))
#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> bool inb(const T &x,const T &l,const T &r) { return l<=x&&x<=r; }
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#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 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(...) _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)"); 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");
	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=e9+7;//998'244'353;





void _main() { /* CURSOR START */
	int n,m; inr(n,arg1), inr(m,n*3,int(n*3.33+1));
	const int N=300<<10;
	static unordered_map<int,int> adj[N];
	vector<tuple<int,int,int>> es;
	#define upd(u,v,w) (adj[u][v]=adj[v][u]=min(adj[u].count(v)?adj[u][v]:inf,w))
	for(int i=1;i<=m;i++) {
		int u,v,w; inr(u,n), inr(v,n), inr(w,e9);
		upd(u,v,w);
		es.pb({w,u,v});
	}

	static int da[N];
	auto rt=fix([&](auto rec,int u) -> int { return da[u]?da[u]=rec(da[u]):u; });
	int z=inf+inf;
	if(adj[1].count(n)) z=adj[1][n];

	sort(all(es));
	for(auto [_w,u,v]:es) {
		if(_w+_w>=z) break;
		(void)_w;
		u=rt(u),v=rt(v);
		if(u==v) continue;
		if(u==rt(1)&&v==rt(n)) assert(0);
		if(u==rt(n)&&v==rt(1)) assert(0);
		if(sz(adj[u])<sz(adj[v])) swap(u,v);
		da[v]=u;
		for(auto [__w,x]:adj[v]) {
			int w=__w;
			w=rt(w);
			adj[w].erase(v);
			upd(u,w,x);
		}
		adj[u].erase(v);
		if(adj[rt(1)].count(rt(n))) z=min(z,_w+adj[rt(1)][rt(n)]);
	}
	cout<<z<<endl;
}

詳細信息

Test #1:

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

input:

4 6
1 2 2
1 3 4
1 4 7
2 3 1
2 4 3
3 4 9

output:

5

result:

ok 1 number(s): "5"

Test #2:

score: 0
Accepted
time: 347ms
memory: 79944kb

input:

300000 299999
80516 80517 597830404
110190 110191 82173886
218008 218009 954561262
250110 250111 942489774
66540 66541 156425292
34947 34948 239499776
273789 273790 453201232
84428 84429 439418398
98599 98600 326095035
55636 55637 355015760
158611 158612 684292473
43331 43332 43265001
171621 171622 ...

output:

1999991697

result:

ok 1 number(s): "1999991697"

Test #3:

score: 0
Accepted
time: 416ms
memory: 79892kb

input:

300000 299999
207226 231742 414945003
84591 210444 175968953
46327 51582 612565723
18773 141119 82562646
76139 286963 762958587
131867 224820 928900783
215240 216181 405340417
144725 290878 195350550
267216 268752 846015171
31413 255927 389339642
45219 147512 489502910
113391 215402 555706684
53359 ...

output:

1989898633

result:

ok 1 number(s): "1989898633"

Test #4:

score: 0
Accepted
time: 201ms
memory: 80868kb

input:

300000 299999
1 118488 989720257
1 181002 810258689
1 254222 172925351
1 176703 737330574
1 218306 941887568
1 105741 645573853
1 188490 794789787
1 273997 91455946
1 214929 293300204
1 127289 600097406
1 30589 330284120
1 128954 532459734
1 163729 627033607
1 24073 718818252
1 41571 755054850
1 560...

output:

725564985

result:

ok 1 number(s): "725564985"

Test #5:

score: 0
Accepted
time: 311ms
memory: 78688kb

input:

300000 299999
19784 19785 438457172
153297 239456 192671538
153297 202254 645947104
9640 9641 583410541
153297 221084 490232940
32210 32211 838809517
153297 171896 625627853
153297 216946 683286844
110843 110844 690710575
153297 176413 983037656
74908 74909 375017711
67676 67677 695121437
153297 196...

output:

1999992880

result:

ok 1 number(s): "1999992880"

Test #6:

score: 0
Accepted
time: 335ms
memory: 78964kb

input:

300000 299999
130662 244000 579178004
167657 294630 753914681
61924 61925 165841675
113560 113561 979316325
151574 218075 973289843
1224 1225 230803236
133441 133442 806726301
167309 249456 853031541
120245 120246 688705252
142688 217826 692299631
106114 106115 735998084
123268 123269 749737073
1208...

output:

1999989691

result:

ok 1 number(s): "1999989691"

Test #7:

score: 0
Accepted
time: 454ms
memory: 79496kb

input:

300000 299999
54474 108948 971770803
11077 22155 470962125
115359 230718 373029049
124472 248944 865510218
11958 23917 100575860
130349 260698 582886291
17563 35127 697131917
54427 108854 274252758
51546 103092 198620066
100126 200252 154524070
14994 29988 528701437
147502 295004 531813162
42285 845...

output:

1823402145

result:

ok 1 number(s): "1823402145"

Test #8:

score: 0
Accepted
time: 399ms
memory: 78676kb

input:

300000 299999
240182 240189 427579190
41871 41880 360542232
57131 57140 353813367
122650 122653 621913649
67332 67340 271427538
107523 107524 774306311
60374 60379 315636931
130805 130808 667109508
154531 154534 327293148
138561 138569 833879694
32543 32551 382610722
287398 287400 211744079
59693 59...

output:

1999983202

result:

ok 1 number(s): "1999983202"

Test #9:

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

input:

10 20
1 6 98
3 4 3
4 5 26
7 8 72
1 2 86
3 7 83
7 10 89
4 7 100
3 6 59
6 9 74
5 6 28
6 7 1
2 9 100
2 6 99
5 10 85
8 10 97
2 10 98
8 9 3
2 3 94
9 10 71

output:

170

result:

ok 1 number(s): "170"

Test #10:

score: 0
Accepted
time: 4ms
memory: 20436kb

input:

10 20
2 8 94
3 7 81
8 10 85
2 4 88
4 5 90
1 4 96
3 6 95
7 10 77
1 8 98
4 7 91
2 6 38
1 10 89
1 3 45
4 9 94
3 9 64
6 10 83
5 8 19
2 5 81
6 7 92
3 4 92

output:

89

result:

ok 1 number(s): "89"

Test #11:

score: 0
Accepted
time: 4ms
memory: 20464kb

input:

10 20
1 6 58
1 4 80
1 10 28
1 3 46
6 7 76
7 10 75
4 9 95
2 10 92
1 7 15
9 10 52
3 6 93
5 7 94
1 2 75
1 5 41
3 7 79
4 8 94
2 6 80
6 9 63
1 9 42
1 8 9

output:

28

result:

ok 1 number(s): "28"

Test #12:

score: 0
Accepted
time: 5ms
memory: 20520kb

input:

10 20
6 9 79
5 6 72
2 5 74
2 4 74
8 10 90
1 5 82
3 4 55
6 10 94
7 8 55
3 7 92
1 8 83
9 10 93
4 7 98
4 5 24
2 3 28
6 7 24
1 2 63
3 10 99
8 9 2
5 10 95

output:

158

result:

ok 1 number(s): "158"

Test #13:

score: 0
Accepted
time: 4ms
memory: 20688kb

input:

10 20
3 4 75
5 7 98
3 10 91
5 8 41
2 7 84
2 3 73
4 10 100
2 4 80
1 5 99
3 9 79
4 5 97
4 9 10
4 7 52
1 10 96
8 10 98
6 9 99
1 2 50
5 9 98
2 9 93
3 6 92

output:

96

result:

ok 1 number(s): "96"

Test #14:

score: 0
Accepted
time: 4ms
memory: 20688kb

input:

10 20
1 5 84
9 10 98
2 3 56
2 4 5
3 9 95
4 9 94
3 7 82
6 8 68
1 3 10
4 8 64
3 6 46
5 10 58
5 7 92
6 7 96
1 2 38
2 5 74
1 8 70
8 9 100
4 7 93
7 9 98

output:

132

result:

ok 1 number(s): "132"

Test #15:

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

input:

10 20
2 10 100
8 10 100
7 10 85
3 7 73
5 7 100
4 9 100
1 8 7
2 4 26
6 8 27
3 4 100
6 7 100
2 3 99
3 9 66
9 10 13
4 8 75
1 2 8
4 10 100
1 6 19
7 9 99
2 5 49

output:

107

result:

ok 1 number(s): "107"

Test #16:

score: 0
Accepted
time: 4ms
memory: 20524kb

input:

100 200
60 77 957
70 71 589
63 64 915
13 79 1000
8 9 757
41 42 141
21 53 1000
82 99 911
58 59 683
62 63 889
92 93 455
71 72 457
11 92 1000
9 43 1000
94 95 582
57 58 606
54 55 162
27 28 732
99 100 256
42 43 201
13 99 1000
15 73 1000
19 20 646
22 91 1000
22 50 1000
93 94 888
14 15 904
10 47 1000
68 83...

output:

1671

result:

ok 1 number(s): "1671"

Test #17:

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

input:

100 200
21 59 969
4 22 998
47 98 637
8 51 982
48 55 995
14 65 22
3 35 987
40 46 969
6 82 432
13 98 960
24 49 965
5 32 571
20 71 617
71 82 982
30 66 979
76 79 255
7 56 965
18 21 971
53 65 81
63 64 991
6 88 949
1 13 995
31 38 405
40 91 952
47 89 956
8 84 475
29 90 202
6 12 975
30 89 509
47 88 82
4 58 ...

output:

1859

result:

ok 1 number(s): "1859"

Test #18:

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

input:

100 200
19 29 909
22 86 785
1 56 28
38 85 942
1 52 89
1 78 693
4 30 975
54 99 939
1 89 461
1 59 390
1 95 576
1 92 343
1 11 876
1 85 109
29 78 958
74 81 981
10 49 799
1 39 767
41 92 641
1 69 149
1 34 984
13 70 896
32 44 949
1 20 137
1 90 85
2 70 545
4 58 910
33 60 818
89 96 906
66 100 997
1 55 85
1 9...

output:

896

result:

ok 1 number(s): "896"

Test #19:

score: 0
Accepted
time: 2ms
memory: 20428kb

input:

100 200
11 89 997
30 81 985
58 62 260
23 29 995
58 97 909
69 91 986
58 83 597
11 12 858
58 98 213
58 93 465
8 9 638
5 79 996
58 91 659
37 98 990
47 50 993
43 61 986
37 81 997
58 75 102
22 64 998
4 23 990
41 87 1000
73 95 982
30 31 722
13 43 998
17 18 659
42 52 974
32 48 939
53 90 996
69 86 943
4 5 2...

output:

1943

result:

ok 1 number(s): "1943"

Test #20:

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

input:

100 200
14 21 980
1 2 23
61 80 984
51 52 626
1 71 828
31 32 797
60 61 436
17 61 957
35 73 85
30 37 879
48 72 267
53 54 482
7 91 997
37 88 576
26 74 996
50 93 998
8 75 993
30 80 809
26 40 866
23 89 969
60 77 964
44 80 964
28 68 899
17 100 995
47 92 989
57 58 630
35 36 291
36 37 70
18 20 888
12 99 892...

output:

427

result:

ok 1 number(s): "427"

Test #21:

score: 0
Accepted
time: 4ms
memory: 20712kb

input:

100 200
11 12 980
33 66 341
60 88 997
41 83 156
11 22 995
29 75 736
44 73 996
8 68 965
49 62 935
65 81 998
5 10 229
58 74 934
55 88 998
27 90 999
10 21 409
3 74 911
11 84 1000
9 95 988
3 6 393
16 61 956
34 88 1000
34 67 966
21 43 66
12 61 837
14 56 413
12 42 998
26 52 778
6 12 830
63 78 844
6 36 893...

output:

1505

result:

ok 1 number(s): "1505"

Test #22:

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

input:

100 200
83 88 101
56 59 191
64 71 419
7 26 927
48 57 69
9 41 741
43 67 993
21 56 916
20 22 801
35 42 973
78 85 138
26 50 924
87 96 727
19 96 997
9 26 848
21 28 820
39 49 537
47 72 900
55 63 672
18 19 109
9 60 923
8 82 988
8 18 795
9 34 618
23 28 649
67 68 366
10 12 500
23 38 819
10 17 815
69 99 998
...

output:

1402

result:

ok 1 number(s): "1402"

Test #23:

score: -100
Time Limit Exceeded

input:

300000 1000000
279851 289752 999954614
161068 161069 686040658
98775 290773 999996999
152639 152640 726594968
83070 83071 812508473
91034 126281 999954538
86789 222983 999990457
95587 176851 999991161
33638 137265 999988809
84658 192641 999991026
153523 295952 999998616
174583 243251 999987129
12518...

output:


result: