diff --git a/src/20241118/T541155.cpp b/src/20241118/T541155.cpp index ba8c8af..2262aec 100644 --- a/src/20241118/T541155.cpp +++ b/src/20241118/T541155.cpp @@ -1,3 +1,42 @@ +/* +100pts but hack +in: + +10 +7 +41 20 50 18 25 -23 -32 +10 +8 35 -49 49 -27 8 33 8 36 16 +5 +-16 4 -17 -38 -25 +8 +-12 -7 -47 4 42 30 4 -36 +8 +-17 -3 15 -7 -27 -35 17 35 +10 +-6 49 -21 49 47 20 17 41 -39 27 +8 +2 44 36 -45 -8 -15 -9 16 +10 +1 33 -15 11 15 -10 19 -42 37 -5 +6 +40 19 45 -28 34 42 +8 +10 5 4 -47 -7 -37 23 21 +ans: + +-1 -1 +47628 47628 +-1 -1 +3528 3528 +8925 8925 +-4182 <-failed -2754 <-pass +10800 10800 +10545 10545 +27132 27132 +39997 39997 +*/ + #include #include #include @@ -21,10 +60,47 @@ int main(){ cin>>a[i]; rset.emplace(a[i]); } - rset.erase(rset.find(a[1])); + + // if(auto it{rset.find(a[1])};it!=rset.end())[[likely]]{ + rset.erase(rset.find(a[1])); + // }else{ + // throw std::runtime_error("unreachable"); + // } lset.emplace(a[1]); for(ll i{2};ivoid{ + // cout<=a[i]){ + if(lit==lset.begin())goto out; + --lit; + } + if(lit!=lset.end()){ + check_ans(*lit, a[i], *rset.rbegin()); + } + } + out:; + { + if(auto it = rset.lower_bound(a[i]);it!=rset.end()){ + check_ans(*lset.begin() , a[i], *it); + } + } + //-8 -4 10 + check_ans(*lset.begin(),a[i],*rset.rbegin()); + lset.emplace(a[i]); } cout<<(ans==-inf?-1:ans)<<'\n'; diff --git a/src/20241118/T541155_in.cpp b/src/20241118/T541155_in.cpp index 3169186..7552514 100644 --- a/src/20241118/T541155_in.cpp +++ b/src/20241118/T541155_in.cpp @@ -3,16 +3,24 @@ #include using ll = int64_t; -using std::cin, std::cout; +using std::cout; -const ll inf = (1l<<32); +const ll inf = 20; int main(){ std::random_device rd; std::mt19937_64 mt{rd()}; - std::uniform_int_distribution uid{-inf, inf}; - ll t {100}; - while (t--) { - cout< uidn{5, inf}; + auto t = uidn(mt); + cout< uida{1,inf}; + while(n--){ + cout<