QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#494199 | #9141. Array Spread | ucup-team008# | TL | 2618ms | 242924kb | C++23 | 15.9kb | 2024-07-27 14:40:23 | 2024-07-27 14:40:23 |
Judging History
你现在查看的是最新测评结果
- [2024-09-18 18:58:44]
- hack成功,自动添加数据
- (/hack/840)
- [2024-09-18 18:53:02]
- hack成功,自动添加数据
- (/hack/839)
- [2024-07-29 03:53:23]
- hack成功,自动添加数据
- (/hack/753)
- [2024-07-29 03:51:16]
- hack成功,自动添加数据
- (/hack/752)
- [2024-07-29 03:50:24]
- hack成功,自动添加数据
- (/hack/751)
- [2024-07-29 03:48:52]
- hack成功,自动添加数据
- (/hack/750)
- [2024-07-27 14:40: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.front(); 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;
}
typedef double T; // long double, Rational, double + mod<P>...
typedef vector<int> vi;
typedef vector<T> vd;
typedef vector<vd> vvd;
#define rep(i,l,r) for(int i=l;i<r;i++)
#define inf ensiota
const T eps = 1e-8, inf = 1/.0;
#define MP make_pair
#define ltj(X) if(s == -1 || MP(X[j],N[j]) < MP(X[s],N[s])) s=j
struct LPSolver {
int m, n;
vi N, B;
vvd D;
LPSolver(const vvd& A, const vd& b, const vd& c) :
m(sz(b)), n(sz(c)), N(n+1), B(m), D(m+2, vd(n+2)) {
rep(i,0,m) rep(j,0,n) D[i][j] = A[i][j];
rep(i,0,m) { B[i] = n+i; D[i][n] = -1; D[i][n+1] = b[i];}
rep(j,0,n) { N[j] = j; D[m][j] = -c[j]; }
N[n] = -1; D[m+1][n] = 1;
}
void pivot(int r, int s) {
T *a = D[r].data(), inv = 1 / a[s];
rep(i,0,m+2) if (i != r && abs(D[i][s]) > eps) {
T *b = D[i].data(), inv2 = b[s] * inv;
rep(j,0,n+2) b[j] -= a[j] * inv2;
b[s] = a[s] * inv2;
}
rep(j,0,n+2) if (j != s) D[r][j] *= inv;
rep(i,0,m+2) if (i != r) D[i][s] *= -inv;
D[r][s] = inv;
swap(B[r], N[s]);
}
bool simplex(int phase) {
int x = m + phase - 1;
for (;;) {
int s = -1;
rep(j,0,n+1) if (N[j] != -phase) ltj(D[x]);
if (D[x][s] >= -eps) return true;
int r = -1;
rep(i,0,m) {
if (D[i][s] <= eps) continue;
if (r == -1 || MP(D[i][n+1] / D[i][s], B[i])
< MP(D[r][n+1] / D[r][s], B[r])) r = i;
}
if (r == -1) return false;
pivot(r, s);
}
}
T solve(vd &x) {
int r = 0;
rep(i,1,m) if (D[i][n+1] < D[r][n+1]) r = i;
if (D[r][n+1] < -eps) {
pivot(r, n);
if (!simplex(2) || D[m+1][n+1] < -eps) return -inf;
rep(i,0,m) if (B[i] == -1) {
int s = 0;
rep(j,1,n+1) ltj(D[i]);
pivot(i, s);
}
}
bool ok = simplex(1); x = vd(n);
rep(i,0,m) if (B[i] < n) x[B[i]] = D[i][n+1];
return ok ? D[m][n+1] : inf;
}
};
auto solve() { /* CURSOR START */
int n,m; inr(n,e9), ine(m,arg1);
map<int,vector<int>> mm;
for(int j=1;j<=m;j++) {
int l,r; inr(l,n), inr(r,l,n);
mm[l].pb(j);
mm[r+1].pb(-j);
}
set<int> enab;
n=sz(mm);
vvd A;
vd constr(n+1,0);
for(int j=1;j<=m;j++) A.pb(constr);
for(int j=1;j<=m;j++) A.pb(constr);
forenum(i,auto [_,v]:mm) {
for(int j:v) {
if(j>0) enab.insert(j);
else enab.erase(-j);
}
for(int j=1;j<=m;j++) if(enab.count(j)) A[j-1][i]=1, A[m+j-1][i]=-1;
}
for(int j=1;j<=m;j++) A[j-1][n]=-1;
vd b(m*2);
for(int j=1;j<=m;j++) b[m+j-1]=-1;
vd x(n+1,0);
vd c(n+1,0); c[n]=-1;
T val=-LPSolver(A,b,c).solve(x);
vector<pair<T,int>> rr;
for(int d=1;d<=n;d++) {
flt nn=val*d;
int n=int(nn+.5);
rr.pb({abs(nn-n),int(1LL*n*powq(d,P-2)%P)});
}
sort(all(rr)); return rr[0].se;
int z=int(val*2+.5);
if(z%2) z+=P;
z/=2;
dbg(val,z);
return z;
}
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: 3648kb
input:
3 3 3 1 3 2 3 1 2 12 6 2 3 5 7 1 9 4 8 1 2 7 11 4 5 3 4 2 3 1 2 4 4 1 1
output:
1 2 499122178
result:
ok 3 number(s): "1 2 499122178"
Test #2:
score: 0
Accepted
time: 5ms
memory: 3628kb
input:
2000 1000000000 1 259923446 367011266 1000000000 1 882434225 971573327 1000000000 1 41585677 470369580 1000000000 1 371902212 947250194 1000000000 1 787209148 924205796 1000000000 1 259074809 960876164 1000000000 1 148079314 188254573 1000000000 1 940091047 948318624 1000000000 1 40636497 743979446 ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 2000 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
1000 1000000000 5 575330909 661595447 708422488 913945134 658050911 930246647 786571892 904549453 851755566 969150871 1000000000 2 198072104 844159589 8876188 644559580 1000000000 2 740802634 976972118 783909534 898449184 1000000000 2 871819537 941611957 465883854 640988372 1000000000 1 99458969 462...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 ...
result:
ok 1000 numbers
Test #4:
score: 0
Accepted
time: 4ms
memory: 3684kb
input:
500 1000000000 13 964546318 987364574 367845944 907446075 259314137 890312338 458318546 959971971 353677471 522446336 782931403 845199078 514387878 786979588 532634932 793056892 905393511 960628299 747423889 986373313 796099347 833069525 906969434 971335651 574582540 647534593 1000000000 6 987712893...
output:
3 1 3 1 1 1 1 1 1 3 2 1 1 1 3 1 2 1 1 2 1 3 1 1 1 2 1 2 2 1 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 2 1 1 3 1 2 1 1 1 1 2 3 1 1 1 1 1 1 1 3 2 1 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 3 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 4 1 2 1 4 1 3 1 1 1 1 1 2 1 1 4 1 ...
result:
ok 500 numbers
Test #5:
score: 0
Accepted
time: 3ms
memory: 4196kb
input:
250 1000000000 10 844342043 888135880 127033337 726074967 581308029 893912240 414276384 752837267 565680461 863374082 230362895 477723054 210479116 423381051 325072305 427826920 178306222 756423471 376470949 993759748 1000000000 2 468173597 607783582 266359996 863641680 1000000000 7 206599093 941381...
output:
2 1 2 1 3 3 1 1 1 2 1 2 2 1 3 5 2 1 1 1 2 1 2 1 3 1 2 1 3 499122178 1 1 1 1 3 1 1 1 3 3 3 1 4 1 1 1 1 1 1 1 1 5 1 4 2 1 3 1 1 1 2 5 2 1 2 6 2 2 1 2 1 1 1 5 8 2 1 2 1 1 2 2 2 1 1 5 8 3 1 1 1 8 2 6 1 1 4 2 1 1 1 1 2 2 1 2 1 1 1 1 1 1 2 1 2 1 1 4 1 1 3 1 2 3 3 2 5 1 1 1 3 2 1 1 1 3 1 1 2 1 1 1 1 3 1 1 ...
result:
ok 250 numbers
Test #6:
score: 0
Accepted
time: 7ms
memory: 4020kb
input:
250 1000000000 4 10495745 465086423 465086424 609997778 396956207 663037010 253873206 396956206 1000000000 33 596279983 655818820 226461062 338625457 407323582 423049163 711408063 778512581 220274357 226461061 702491412 711408062 686978949 688730316 369564474 434159428 778512582 787885602 675683057 ...
output:
1 2 748683266 5 6 453747435 1 10 6 1 499122183 1 4 3 1 3 1 748683266 2 499122179 10 499122178 1 499122179 4 1 7 1 665496238 2 2 2 332748119 249561090 816745381 499122178 2 499122179 5 3 4 17 1 2 2 3 249561092 1 3 924300328 499122179 2 3 332748120 2 7 3 499122187 6 374341634 1 2 332748120 2 2 2 49912...
result:
ok 250 numbers
Test #7:
score: 0
Accepted
time: 7ms
memory: 4224kb
input:
100 1000000000 17 272213590 960979163 970159974 987653658 201788340 556786243 46564706 948945765 786605927 819103747 510930374 747773556 729597186 850647589 412727504 443334406 685627406 773178988 793614323 909668193 830162056 837607472 416766039 753918198 237455713 993045890 848459092 851118478 463...
output:
8 1 1 2 3 3 1 5 1 2 8 2 1 1 3 1 3 6 3 3 2 3 7 2 1 1 3 1 2 1 5 5 2 2 4 2 7 2 1 6 1 2 5 4 5 4 1 1 1 8 6 1 4 4 5 13 1 4 9 4 8 3 8 5 4 7 1 8 1 1 1 9 2 1 6 4 4 3 1 1 1 10 4 6 11 6 6 1 1 4 1 4 2 2 13 5 1 1 5 8
result:
ok 100 numbers
Test #8:
score: 0
Accepted
time: 13ms
memory: 4260kb
input:
100 1000000000 49 187775019 193881727 145323628 162242601 964365230 971504847 226437670 229819402 46971378 49331905 871327590 883354570 310535966 323031740 904117712 916571909 458902934 484636144 13320536 14923771 571938132 574937141 89751784 102733764 412667720 421251698 908036941 932886651 2663244...
output:
2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 1 1 3 1 3 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 3 1 1 1 1 3 1 1 1 1 1 2 1 1 1 1 1 2 1 2 2 1 1 1
result:
ok 100 numbers
Test #9:
score: 0
Accepted
time: 15ms
memory: 4196kb
input:
100 1000000000 33 607773622 612059886 773446566 927093401 216659567 357373353 949986996 960422356 67865304 185683459 748675762 867719748 419805439 434936264 83601801 106508219 584299087 639485780 487166380 588591547 670602250 789210083 877816826 902687951 800334389 834278741 90815648 214176329 53952...
output:
4 1 4 6 3 1 1 7 1 1 3 3 1 4 4 1 2 4 1 5 1 2 2 1 2 9 2 1 2 2 1 2 1 2 4 2 2 1 1 3 2 2 2 1 1 1 1 4 1 1 2 1 1 1 2 1 7 1 1 1 6 2 1 3 6 4 10 1 1 3 5 1 1 10 8 1 3 1 1 2 3 1 1 6 1 2 1 2 3 3 2 4 1 3 2 7 1 1 1 1
result:
ok 100 numbers
Test #10:
score: 0
Accepted
time: 18ms
memory: 4116kb
input:
100 1000000000 27 423127198 447304856 209683651 219301129 831320345 879604518 631502329 814498734 130918283 202258454 434769186 463838309 448295746 500976275 778017547 864887407 60178254 66348236 615735891 725460273 78684718 129678593 219427409 221445385 242513397 378886240 549135209 710348598 24951...
output:
748683266 2 332748119 2 855638018 2 2 2 1 1 499122179 1 630470119 1 873463814 10 3 598946613 499122178 499122179 720954257 24956110 686292996 499122178 6 2 499122180 332748122 665496237 27 17 1 15 5 199648872 6 4 3 1 285212675 2 1 4 2 499122186 698771050 844668300 887328319 332748120 1 2 499122179 4...
result:
ok 100 numbers
Test #11:
score: 0
Accepted
time: 20ms
memory: 5008kb
input:
50 1000000000 54 393385964 584227315 530511168 878333402 240442438 693353417 66549203 383382851 432995043 781030135 902504635 941834946 40257869 409360381 186795487 285734229 500620269 578283640 769614926 881642580 651338390 854914246 220143804 506609845 486528251 695975933 659594236 951619961 26914...
output:
6 3 9 1 5 1 5 7 4 9 11 7 4 10 1 1 3 1 1 7 11 12 7 6 6 7 1 14 9 5 3 11 7 5 10 1 1 14 2 8 16 4 4 2 2 6 4 1 1 9
result:
ok 50 numbers
Test #12:
score: 0
Accepted
time: 3ms
memory: 3796kb
input:
50 10 65 7 10 3 6 5 7 7 7 3 9 2 2 3 10 10 10 7 7 2 3 5 6 7 10 3 9 2 8 2 8 8 8 4 8 9 9 9 9 7 9 1 1 3 6 9 10 9 10 2 3 7 8 9 10 2 9 9 10 10 10 5 7 6 10 6 8 4 5 10 10 5 5 5 10 8 8 1 9 6 7 3 6 1 9 2 5 1 10 2 9 8 9 8 8 1 1 2 9 4 9 10 10 7 10 2 3 8 9 10 10 2 4 2 9 4 7 1 3 1 9 10 10 1 4 8 9 7 8 7 8 10 88 6 ...
output:
7 8 7 6 4 4 6 4 6 8 7 6 6 3 499122178 3 3 7 10 4 2 3 5 2 8 2 8 1 4 7 4 4 7 6 1 4 2 5 3 6 4 2 1 6 1 6 3 9 6 4
result:
ok 50 numbers
Test #13:
score: 0
Accepted
time: 35ms
memory: 6416kb
input:
25 1000000000 126 107069149 368376053 479032115 765537110 991540256 997326292 403046092 722244014 490526523 516722534 274125538 310843747 777271932 894507975 30859549 117930127 295842439 932626190 696990395 727705976 919364307 981912430 452436750 754049053 436429356 707440965 255169020 717543449 875...
output:
13 12 14 15 3 8 13 499122178 9 17 3 3 5 6 6 22 3 3 16 6 17 5 6 9 19
result:
ok 25 numbers
Test #14:
score: 0
Accepted
time: 99ms
memory: 14268kb
input:
10 1000000000 69 870434015 950861762 463726401 635711398 333118041 890448132 290535922 477961269 413309490 468893401 200588542 259174530 820993949 902249431 919016091 952057155 32176623 226256591 307850591 328322116 544612131 956816575 794988232 980183910 896176727 934471390 445409718 674881616 3109...
output:
7 21 17 13 6 11 30 26 17 14
result:
ok 10 numbers
Test #15:
score: 0
Accepted
time: 345ms
memory: 42080kb
input:
10 1000000000 226 722573032 815472621 582575925 607010515 411370955 463267466 92061989 217643130 187859011 258319855 811376535 844552673 426496326 431292091 785538560 983675713 328209738 364768843 338697990 509158393 502285144 536085577 202590577 293138489 873383022 956559039 765186726 836986281 219...
output:
15 5 5 12 18 2 13 12 35 8
result:
ok 10 numbers
Test #16:
score: 0
Accepted
time: 3ms
memory: 3928kb
input:
10 10 31 7 8 5 9 2 4 6 10 10 10 4 5 3 6 8 8 4 10 7 8 2 8 2 7 3 4 9 9 4 7 1 8 1 10 3 9 2 5 5 8 5 8 5 8 6 6 2 10 3 7 9 10 9 10 7 7 6 6 9 10 6 7 10 165 10 10 9 9 4 9 9 9 1 1 6 8 2 9 4 6 10 10 8 9 5 9 8 8 6 10 6 6 4 6 1 6 3 7 5 9 2 8 5 6 3 5 6 9 6 8 4 7 5 8 9 9 5 7 10 10 5 8 9 10 5 5 3 8 7 10 1 1 7 8 6 ...
output:
6 9 10 10 10 7 9 9 8 9
result:
ok 10 numbers
Test #17:
score: 0
Accepted
time: 525ms
memory: 68136kb
input:
5 1000000000 63 619459262 977043459 300995683 982228427 410548612 621234006 122929033 763884440 421486730 819706101 340188689 623537684 507398179 844353491 337184385 791508531 349294635 959826734 98096933 650360479 385580668 846357810 364950155 640902318 640098682 994083922 770432519 820631492 66011...
output:
8 17 6 40 44
result:
ok 5 number(s): "8 17 6 40 44"
Test #18:
score: 0
Accepted
time: 2618ms
memory: 242924kb
input:
2 1000000000 1954 214176902 795098577 427614652 861416360 690405909 903037538 224031724 678866146 103017905 175158461 481177251 880591454 774838238 795104831 887429528 996876768 889351335 987035745 391908934 489988622 83670551 709453888 679022699 842242196 78153409 642923089 232797325 414737043 6804...
output:
66 8
result:
ok 2 number(s): "66 8"
Test #19:
score: -100
Time Limit Exceeded
input:
1 1000000000 2000 804998774 935072473 539475366 898950940 227523606 852755701 309719052 650340983 356982928 655220770 783115802 937764030 570168460 665560212 583166562 906377079 947557671 947616592 774446890 997986030 113320562 897048797 39935214 749273732 63763440 415540685 961986268 990569362 9656...