QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#292704#5567. Balanced PermutationsRadewoosh#WA 235ms14856kbC++237.7kb2023-12-28 11:35:252023-12-28 11:35:26

Judging History

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

  • [2023-12-28 11:35:26]
  • 评测
  • 测评结果:WA
  • 用时:235ms
  • 内存:14856kb
  • [2023-12-28 11:35:25]
  • 提交

answer

//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;
const int vax=1007;
const ll inf=1007LL*1007LL*1007LL*1007LL*1007LL*1007LL;
using mag=__int128;

int n;

int koszt[nax];
pii prz[nax];
ll dp[nax];

ll kom[vax][vax];

int gdzdol[nax];
int gdzgor[nax];

ll mnoz(ll a, ll b)
{
	return min(a*(mag)b, (mag)inf);
}

ll pytkom(int a, int b)
{
	assert(b>=0 && b<=a);
	if (a<vax)
		return kom[a][b];
	return 1;
}

vi operator +(vi a, vi b)
{
	for (int i : b)
		a.push_back(i);
	return a;
}

vi lift(vi a, int b)
{
	for (int &i : a)
		i+=b;
	return a;
}

void wypisz(vi wek)
{
	for (int i : wek)
		printf("%d ", i);
	printf("\n");
}

ll pasuje(int k, vi per, int m)
{
	int r=per.size();
	for (int i : per)
		if (i>m)
			return 0;
	if (m<k)
		return 0;
	if (!r)
		return mnoz(dp[k], kom[m][k]);
	ll ret=0;
	int g=0;
	for (int i=0; i<r; i++)
		if (per[i]>per[g])
			g=i;
	g++;
	for (int i=prz[k].first; i<=prz[k].second; i++)
	{
		ret=min(ret, inf);
		if (i<=r)
		{
			if (i!=g)
				continue;
			if (per[g-1]<k)
				continue;
			int ko=0;
			for (int a=1; a<i; a++)
			{
				int naj=0;
				for (int b=a; b<i; b++)
				{
					naj=max(naj, per[b-1]);
					if (naj==max(per[a-1], per[b-1]))
						ko++;
				}
			}
			if (ko!=koszt[i-1])
				continue;
			int j=per[g-1];
			vi napra(j+1, 1);
			napra[0]=napra[j]=0;
			for (int l=1; l<i; l++)
				napra[per[l-1]]=0;
			for (int l=2; l<j; l++)
				napra[l]+=napra[l-1];
			vi pra;
			for (int l=i+1; l<=r; l++)
				pra.push_back(napra[per[l-1]]);
			//~ ll staret=ret;
			ret+=pasuje(k-i, pra, j-1-(i-1));
			//~ debug() << imie(k) << " " << imie(m) << " " << i << " " << j << " z " << staret << " na " << ret << "     A";
		}
		else
		{
			for (int j=max(per[g-1]+1, k); j<=m; j++)
			{
				//~ ll staret=ret;
				ret+=mnoz(mnoz(pasuje(i-1, per, j-1), dp[k-i]), kom[j-1-(i-1)][k-1-(i-1)]);
				//~ debug() << imie(k) << " " << imie(m) << " " << i << " " << j << " z " << staret << " na " << ret << "     B";
			}
		}
	}
	ret=min(ret, inf);
	//~ debug() << imie(k) << imie(per) << imie(m) << imie(ret);
	return ret;
}

vi solve_smallest(int k, ll kt)
{
	if (!k)
		return vi{};
	if (dp[k]<kt)
		return {-1};
	if (dp[k-gdzdol[k]]>=kt)
		return solve_smallest(gdzdol[k]-1, 1)+vi{k}+lift(solve_smallest(k-gdzdol[k], kt), gdzdol[k]-1);
	vi juz(k+1);
	vi tab;
	for (int i=1; i<=k; i++)
	{
		for (int j=1; 1; j++)
		{
			assert(j<=k);
			if (juz[j])
				continue;
			tab.push_back(j);
			ll x=pasuje(k, tab, k);
			if (x<kt)
			{
				kt-=x;
				tab.pop_back();
				continue;
			}
			juz[j]=1;
			break;
		}
	}
	return tab;
}

vi solve_largest(int k, ll kt)
{
	if (!k)
		return vi{};
	if (dp[k]<kt)
		return {-1};
	if (dp[k-gdzgor[k]]>=kt)
		return lift(solve_largest(gdzgor[k]-1, 1), k-gdzgor[k])+vi{k}+solve_largest(k-gdzgor[k], kt);
	vi juz(k+1);
	vi tab;
	for (int i=1; i<=k; i++)
	{
		for (int j=k; 1; j--)
		{
			assert(j>=1);
			if (juz[j])
				continue;
			tab.push_back(j);
			ll x=pasuje(k, tab, k);
			if (x<kt)
			{
				kt-=x;
				tab.pop_back();
				continue;
			}
			juz[j]=1;
			break;
		}
	}
	return tab;
}

//~ vector<vi> per;

//~ int kosztwek(vi &wek)
//~ {
	//~ int ret=0;
	//~ int r=wek.size();
	//~ for (int i=0; i<r; i++)
	//~ {
		//~ int naj=0;
		//~ for (int j=i; j<r; j++)
		//~ {
			//~ naj=max(naj, wek[j]);
			//~ ret+=(naj==max(wek[i], wek[j]));
		//~ }
	//~ }
	//~ return ret;
//~ }

//~ void generuj()
//~ {
	//~ vi tu;
	//~ int s=1;
	//~ for (int i=1; i<=n; i++)
	//~ {
		//~ s*=i;
		//~ tu.push_back(i);
	//~ }
	//~ int best=n*(n+1);
	//~ while(s--)
	//~ {
		//~ int x=kosztwek(tu);
		//~ if (x<best)
		//~ {
			//~ best=x;
			//~ per.clear();
		//~ }
		//~ if (x==best)
		//~ {
			//~ per.push_back(tu);
		//~ }
		//~ next_permutation(tu.begin(), tu.end());
	//~ }
//~ }

int main()
{
	for (int i=0; i<vax; i++)
	{
		kom[i][0]=1;
		for (int j=1; j<=i; j++)
			kom[i][j]=min(inf, kom[i-1][j-1]+kom[i-1][j]);
	}
	scanf("%d", &n);
	{
		gdzdol[1]=1;
		int v=2;
		int u=2;
		for (int i=1; v<=n+7; i<<=1)
		{
			for (int j=0; j<i; j++)
			{
				gdzdol[v]=u;
				v++;
			}
			for (int j=0; j<i; j++)
			{
				gdzdol[v]=u;
				v++;
				u++;
			}
		}
	}
	{
		int v=1;
		int u=1;
		for (int i=1; v<=n+7; i<<=1)
		{
			for (int j=0; j<i; j++)
			{
				gdzgor[v]=u;
				v++;
			}
			for (int j=0; j<i; j++)
			{
				gdzgor[v]=u;
				v++;
				u++;
			}
		}
	}
	dp[0]=1;
	for (int i=1; i<=n; i++)
	{
		koszt[i]=koszt[i/2]+koszt[(i-1)/2]+i;
		
		//~ int bsa=1;
		//~ int bsb=i;
		//~ while(bsa<bsb)
		//~ {
			//~ int bss=(bsa+bsb)>>1;
			//~ if (koszt[bss-1]+koszt[i-bss]+i==koszt[i])
				//~ bsb=bss;
			//~ else
				//~ bsa=bss+1;
		//~ }
		
		int wsk=max(1, prz[i-1].first);
		while(koszt[wsk-1]+koszt[i-wsk]+i!=koszt[i])
			wsk++;
		prz[i]={wsk, i+1-wsk};
		
		//~ prz[i]={bsa, i+1-bsa};
		for (int j=prz[i].first; j<=prz[i].second && dp[i]<inf; j++)
			dp[i]=min(dp[i]+mnoz(mnoz(dp[j-1], dp[i-j]), pytkom(i-1, j-1)), inf);
	}
	
	//~ for (int i=1; i<=n; i++)
	//~ {
		//~ vi faj;
		//~ for (int j=1; j<=i; j++)
			//~ if (koszt[j-1]+koszt[i-j]+i==koszt[i])
				//~ faj.push_back(j);
		//~ for (int j=1; j<(int)faj.size(); j++)
			//~ assert(faj[j]==faj[j-1]+1);
	//~ }
	//~ return 0;
	
	//~ generuj();
	//~ assert((int)per.size()==dp[n]);
	//~ map<vi,int> mapa;
	//~ for (vi i : per)
	//~ {
		//~ vi tu;
		//~ for (int j=1; j<=n; j++)
		//~ {
			//~ tu.push_back(i[j-1]);
			//~ mapa[tu]++;
		//~ }
	//~ }
	//~ {
		//~ int s=1;
		//~ vi tu;
		//~ for (int i=1; i<=n; i++)
		//~ {
			//~ tu.push_back(i);
			//~ s*=i;
		//~ }
		//~ while(s--)
		//~ {
			//~ vi pocz;
			//~ for (int i=1; i<=n; i++)
			//~ {
				//~ pocz.push_back(tu[i-1]);
				//~ int x=0;
				//~ if (mapa.count(pocz))
					//~ x=mapa[pocz];
				//~ assert(x==pasuje(n, pocz, n));
			//~ }
			//~ next_permutation(tu.begin(), tu.end());
		//~ }
	//~ }
	//~ return 0;
	
	ll kt;
	scanf("%lld", &kt);
	wypisz(solve_smallest(n, kt));
	scanf("%lld", &kt);
	wypisz(solve_largest(n, kt));
	return 0;
}

详细

Test #1:

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

input:

3 1 2

output:

1 3 2 
1 3 2 

result:

ok 6 numbers

Test #2:

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

input:

4 9 13

output:

3 1 4 2 
-1 

result:

ok 5 number(s): "3 1 4 2 -1"

Test #3:

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

input:

4 20 7

output:

-1 
2 3 4 1 

result:

ok 5 number(s): "-1 2 3 4 1"

Test #4:

score: 0
Accepted
time: 22ms
memory: 14700kb

input:

99500 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199000 numbers

Test #5:

score: 0
Accepted
time: 21ms
memory: 14620kb

input:

99500 40467622443163494 495971246876580853

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199000 numbers

Test #6:

score: 0
Accepted
time: 22ms
memory: 14636kb

input:

99600 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199200 numbers

Test #7:

score: 0
Accepted
time: 21ms
memory: 14712kb

input:

99600 876080080810139630 528446840542737495

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199200 numbers

Test #8:

score: 0
Accepted
time: 21ms
memory: 14572kb

input:

99700 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199400 numbers

Test #9:

score: 0
Accepted
time: 18ms
memory: 14612kb

input:

99700 711692547767050359 156213023658572307

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199400 numbers

Test #10:

score: 0
Accepted
time: 17ms
memory: 14644kb

input:

99800 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199600 numbers

Test #11:

score: 0
Accepted
time: 12ms
memory: 14416kb

input:

99800 547305006134026495 783979211069374416

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199600 numbers

Test #12:

score: 0
Accepted
time: 18ms
memory: 14692kb

input:

99900 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199800 numbers

Test #13:

score: 0
Accepted
time: 18ms
memory: 14656kb

input:

99900 382917468795969927 188373361625400717

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199800 numbers

Test #14:

score: 0
Accepted
time: 18ms
memory: 14708kb

input:

100000 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 200000 numbers

Test #15:

score: 0
Accepted
time: 13ms
memory: 14644kb

input:

100000 527271021985658374 940151335561648448

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 200000 numbers

Test #16:

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

input:

24999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 49998 numbers

Test #17:

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

input:

24999 136771156689394005 924256336536334059

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 49998 numbers

Test #18:

score: 0
Accepted
time: 3ms
memory: 11696kb

input:

29999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 59998 numbers

Test #19:

score: 0
Accepted
time: 3ms
memory: 11776kb

input:

29999 275583998678440849 312380694035658334

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 59998 numbers

Test #20:

score: 0
Accepted
time: 12ms
memory: 12148kb

input:

34999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 69998 numbers

Test #21:

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

input:

34999 541165311540387602 981345461923895956

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 69998 numbers

Test #22:

score: 0
Accepted
time: 8ms
memory: 12224kb

input:

39999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 79998 numbers

Test #23:

score: 0
Accepted
time: 12ms
memory: 12184kb

input:

39999 903350181794275662 369469819423220230

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 79998 numbers

Test #24:

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

input:

44999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 89998 numbers

Test #25:

score: 0
Accepted
time: 9ms
memory: 12348kb

input:

44999 168931494656222415 261806619871266364

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 89998 numbers

Test #26:

score: 0
Accepted
time: 3ms
memory: 12540kb

input:

49999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 99998 numbers

Test #27:

score: 0
Accepted
time: 9ms
memory: 12368kb

input:

49999 531116369205077770 649930977370590638

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 99998 numbers

Test #28:

score: 0
Accepted
time: 16ms
memory: 12572kb

input:

54999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 109998 numbers

Test #29:

score: 0
Accepted
time: 12ms
memory: 12532kb

input:

54999 796697677772057227 318895740963860964

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 109998 numbers

Test #30:

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

input:

59999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 119998 numbers

Test #31:

score: 0
Accepted
time: 13ms
memory: 12872kb

input:

59999 930392135317961046 514344917370708985

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 119998 numbers

Test #32:

score: 0
Accepted
time: 11ms
memory: 12928kb

input:

64999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 129998 numbers

Test #33:

score: 0
Accepted
time: 14ms
memory: 12976kb

input:

64999 424463865182859336 599356898911231372

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 129998 numbers

Test #34:

score: 0
Accepted
time: 19ms
memory: 13828kb

input:

69999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 139998 numbers

Test #35:

score: 0
Accepted
time: 16ms
memory: 13672kb

input:

69999 563276707171906180 987481256410555646

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 139998 numbers

Test #36:

score: 0
Accepted
time: 16ms
memory: 14236kb

input:

74999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 149998 numbers

Test #37:

score: 0
Accepted
time: 20ms
memory: 13920kb

input:

74999 828858015738885637 879818061153569076

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 149998 numbers

Test #38:

score: 0
Accepted
time: 17ms
memory: 14132kb

input:

79999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 159998 numbers

Test #39:

score: 0
Accepted
time: 13ms
memory: 13704kb

input:

79999 191042890287740993 267942410062958759

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 159998 numbers

Test #40:

score: 0
Accepted
time: 15ms
memory: 14108kb

input:

84999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 169998 numbers

Test #41:

score: 0
Accepted
time: 22ms
memory: 14124kb

input:

84999 456624198854720450 936907177951196380

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 169998 numbers

Test #42:

score: 0
Accepted
time: 18ms
memory: 14476kb

input:

89999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 179998 numbers

Test #43:

score: 0
Accepted
time: 20ms
memory: 14584kb

input:

89999 818809073403575806 325031535450520655

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 179998 numbers

Test #44:

score: 0
Accepted
time: 16ms
memory: 14564kb

input:

94999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 189998 numbers

Test #45:

score: 0
Accepted
time: 20ms
memory: 14540kb

input:

94999 84390386265522559 217368340193534085

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 189998 numbers

Test #46:

score: 0
Accepted
time: 17ms
memory: 14856kb

input:

99999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199998 numbers

Test #47:

score: 0
Accepted
time: 26ms
memory: 14728kb

input:

99999 223203228254569402 605492693397891063

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199998 numbers

Test #48:

score: -100
Wrong Answer
time: 235ms
memory: 10712kb

input:

35 1000000000000000000 1000000000000000000

output:

5 1 6 2 3 9 4 8 7 29 14 27 21 28 15 24 19 35 12 25 23 32 17 26 16 11 34 20 30 22 33 18 31 13 10 
31 32 30 33 28 29 27 34 24 25 22 26 3 10 12 9 11 35 4 8 15 1 20 6 19 14 23 17 18 5 2 21 7 16 13 

result:

wrong answer 1st numbers differ - expected: '1', found: '5'