QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#844182#7596. The One Polynomial ManCarroT1212AC ✓1815ms122640kbC++144.0kb2025-01-05 17:01:512025-01-05 17:01:51

Judging History

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

  • [2025-01-05 17:01:51]
  • 评测
  • 测评结果:AC
  • 用时:1815ms
  • 内存:122640kb
  • [2025-01-05 17:01:51]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std; bool MEM;
using ll=long long; using ld=long double;
using pii=pair<int,int>; using pll=pair<ll,ll>;
const int I=1e9;
const ll J=1e18,N=1e6+7;
namespace FPS {
	const ll P=998244353;
	inline ll add(ll x,ll y){return(x+=y)<P?x:x-P;}
	inline ll dec(ll x,ll y) {return(x-=y)>=0?x:x+P;}
	inline ll qpow(ll x,ll y,ll mul=1) {while(y)mul=y&1?mul*x%P:mul,x=x*x%P,y>>=1;return mul;}
	ll N;
	vector<ll> rev,_inv={0,1};
	inline void NTT_init(ll n) {
		if (N>=n&&N<n<<1) return;
		ll c=-1; N=1; while (N<n) N<<=1,c++;
		if (N>rev.size()) rev.resize(N);
		for (ll i=0;i<N;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<c);
	}
	inline void inv_init(ll n) {
		ll t=_inv.size();
		if (n>t) _inv.resize(n);
		for (ll i=t;i<n;i++) _inv[i]=_inv[P%i]*dec(0,P/i)%P;
	}
	struct fps:vector<ll> {
		friend fps operator * (fps f,fps g) {
			static ll t;
			t=f.size()+g.size()-1;
			if (min(f.size(),g.size())<=40) {
				fps ret(t);
				for (ll i=0;i<f.size();i++) for (ll j=0;j<g.size();j++)
					ret[i+j]=(ret[i+j]+f[i]*g[j])%P;
				return ret;
			}
			NTT_init(t),f.NTT(1),g.NTT(1);
			for (ll i=0;i<N;i++) f[i]=f[i]*g[i]%P;
			f.NTT(-1);
			return f.pre(t);
		}
		friend fps operator + (fps f,fps g) {
			if (f.size()<g.size()) f.swap(g);
			for (ll i=0;i<g.size();i++) f[i]=add(f[i],g[i]);
			return f;
		}
		friend fps operator - (fps f,fps g) {
			if (f.size()<g.size()) f.resize(g.size());
			for (ll i=0;i<g.size();i++) f[i]=dec(f[i],g[i]);
			return f;
		}
		#define f (*this)
		using vector<ll>::vector;
		inline fps pre(ll n) { return fps(f.begin(),f.begin()+min((ll)f.size(),n)); }
		void NTT(ll op) {
			f.resize(N);
			for (ll i=0;i<N;i++) if (i<rev[i]) ::swap(f[i],f[rev[i]]);
			for (ll i=1;i<N;i<<=1) {
				ll w1=qpow(op==1?3:332748118,(P-1)/(i<<1));
				for (ll j=0;j<N;j+=i<<1) for (ll k=j,w=1;k<j+i;k++,w=w*w1%P) {
					ll t1=f[k],t2=w*f[k+i]%P;
					f[k]=add(t1,t2),f[k+i]=dec(t1,t2);
				}
			}
			if (op==-1) {
				ll inv=qpow(N,P-2);
				for (ll i=0;i<N;i++) f[i]=f[i]*inv%P;
			}
		}
		fps inv(ll n=0) {
			if (!n) n=f.size();
			fps g={qpow(f[0],P-2)},h;
			for (ll d=1;d<n;) {
				d<<=1;
				NTT_init(d<<1),h=f.pre(d);
				g.NTT(1),h.NTT(1);
				for (ll i=0;i<N;i++) g[i]=g[i]*dec(2,h[i]*g[i]%P)%P;
				g.NTT(-1),g.resize(d);
			}
			return g.pre(n);
		}
		fps ln(ll n=0) {
			if (!n) n=f.size();
			fps h=f.pre(n);
			for (ll i=0;i+1<h.size();i++) h[i]=(i+1)*h[i+1]%P;
			h.pop_back(),h=(h*f.inv(n)).pre(n),inv_init(n);
			for (ll i=n-1;i>=1;i--) h[i]=h[i-1]*_inv[i]%P;
			return h[0]=0,h;
		}
		fps exp(ll n=0) {
			if (!n) n=f.size();
			fps g={1};
			for (ll d=1;d<n;) d<<=1,g=g*(fps{1}+f.pre(d)-g.ln(d));
			return g.pre(n);
		}
		#undef f
	};
} using FPS::fps;
ll P,n,m,a[N],b[N],g,phi,ans;
ll ca[N],cb[N],cc[N];
ll qp(ll x,ll y=P-2) { return y?(y&1?x:1)*qp(x*x%P,y>>1)%P:1; }
ll sq(ll x) { return x*x%P; }
ll cal(ll a,ll b) {
	if (!sq(3*a+b)||!sq(3*a+2*b)) return P+1;
	return ((sq(2*a+3*b)+5*sq(a))*qp(sq(3*a+b))+(sq(2*a+5*b)+3*sq(b))*qp(sq(3*a+2*b)))%P;
}
void mian() {
	scanf("%lld%lld",&P,&n),phi=P-1;
	for (ll i=1;i<=n;i++) scanf("%lld",&a[i]),ca[a[i]]=1;
	scanf("%lld",&m);
	for (ll i=1;i<=m;i++) scanf("%lld",&b[i]),cb[b[i]]=1;
	for (ll i=1;i<P;i++) if (cb[cal(i,1)]) cc[i]=1;
	vector<ll> prm;
	for (ll i=2,ph=phi;i<=ph;i++) if (ph%i==0) {
		prm.pb(i);
		while (ph%i==0) ph/=i;
	}
	for (g=2;g<P;g++) {
		ll flg=1;
		for (ll j:prm) if (qp(g,phi/j)==1) { flg=0; break; }
		if (flg) break;
	}
	fps F(P+1),G(P+1);
	for (ll i=0,x=1;i+1<P;i++,(x*=g)%=P) if (ca[x]) F[i]=G[P-i]=1;
	F=F*G;
	for (ll i=0,x=1;i+1<P;i++,(x*=g)%=P) if (cc[x]) ans+=F[P+i]+F[i+1];
	if (ca[0]) for (ll i=1;i<P;i++) if (ca[i]) ans+=cb[cal(0,i)]+cb[cal(i,0)];
	cout<<ans;
}
bool ORY; int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	while (1)
//	int t; for (scanf("%d",&t);t--;)
	mian();
	cerr<<"\n"<<abs(&MEM-&ORY)/1048576<<"MB";
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 11880kb

input:

7
4
0 4 5 6
2
2 3

output:

8

result:

ok 1 number(s): "8"

Test #2:

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

input:

19
10
0 3 4 5 8 9 13 14 15 18
10
2 3 5 9 10 11 12 13 14 15

output:

42

result:

ok 1 number(s): "42"

Test #3:

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

input:

7
1
6
2
1 3

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

5
4
0 2 3 4
1
2

output:

5

result:

ok 1 number(s): "5"

Test #5:

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

input:

7
3
1 3 4
4
1 3 4 6

output:

3

result:

ok 1 number(s): "3"

Test #6:

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

input:

53
28
0 2 6 7 8 10 13 17 18 19 21 23 24 27 28 29 30 32 33 34 37 38 39 40 42 43 45 52
23
3 7 12 13 15 16 20 22 23 29 31 33 34 35 37 38 39 40 41 46 48 49 50

output:

265

result:

ok 1 number(s): "265"

Test #7:

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

input:

71
24
1 2 9 12 13 16 18 20 24 29 30 46 49 51 52 53 55 57 58 59 61 62 63 68
35
0 8 9 10 11 13 14 15 16 17 18 19 22 23 24 26 28 31 33 34 36 40 43 45 46 49 50 52 57 59 60 62 65 67 69

output:

334

result:

ok 1 number(s): "334"

Test #8:

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

input:

41
17
0 2 6 9 13 15 18 19 20 21 27 28 30 31 33 34 38
21
0 2 5 6 7 8 15 17 18 19 23 24 27 28 31 32 34 35 37 39 40

output:

112

result:

ok 1 number(s): "112"

Test #9:

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

input:

859
406
0 3 4 8 9 12 15 16 17 19 23 28 29 35 36 39 41 42 43 52 53 61 65 68 70 72 74 75 77 78 79 80 85 86 87 90 91 92 94 99 100 104 106 110 111 115 119 120 121 122 124 134 135 136 143 145 146 147 148 150 151 152 153 154 156 157 158 161 162 166 169 171 177 180 181 182 184 186 193 196 198 201 202 203 2...

output:

83194

result:

ok 1 number(s): "83194"

Test #10:

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

input:

971
450
0 3 4 6 7 11 12 15 16 17 21 22 23 24 26 27 31 33 34 36 37 38 39 40 43 44 45 46 47 48 49 50 51 54 56 58 61 63 64 65 69 70 72 74 76 79 87 88 90 91 92 94 98 99 100 101 104 106 107 110 111 112 117 118 121 122 123 124 128 129 131 132 133 135 136 138 139 141 142 143 144 145 150 154 155 159 163 164...

output:

102834

result:

ok 1 number(s): "102834"

Test #11:

score: 0
Accepted
time: 7ms
memory: 12132kb

input:

4969
2537
0 3 7 8 11 13 15 16 17 20 22 27 28 29 33 35 37 38 39 42 43 45 46 49 52 53 54 55 57 59 63 64 66 69 72 73 74 81 83 86 87 89 90 91 93 95 98 100 101 102 108 109 110 111 112 114 115 120 124 127 129 131 134 135 141 143 144 145 149 151 152 155 158 159 160 161 162 163 166 167 169 171 172 173 175 1...

output:

3302307

result:

ok 1 number(s): "3302307"

Test #12:

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

input:

4973
2470
0 4 6 7 8 9 13 16 18 21 24 26 28 29 30 32 34 35 37 40 43 45 47 48 52 53 55 57 58 59 62 64 68 70 71 78 80 83 84 85 86 87 89 91 92 95 96 98 99 101 105 108 110 111 114 115 116 117 120 124 126 130 131 132 135 140 141 142 143 146 148 151 153 154 162 165 166 168 170 171 172 178 179 184 189 190 1...

output:

2969751

result:

ok 1 number(s): "2969751"

Test #13:

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

input:

9949
4991
3 9 10 11 17 20 23 24 26 27 29 30 31 35 36 37 39 40 43 45 46 47 50 51 52 54 60 64 66 67 69 70 73 74 77 78 82 85 86 88 89 90 91 92 93 95 97 99 103 105 109 110 112 113 114 117 120 121 122 123 124 129 134 135 136 139 144 145 146 148 151 153 154 155 156 157 158 161 162 163 168 169 171 173 174 ...

output:

12373400

result:

ok 1 number(s): "12373400"

Test #14:

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

input:

9829
4924
0 6 7 10 11 12 13 16 18 19 20 22 23 25 33 36 37 38 39 40 42 43 44 46 49 50 52 53 56 57 58 62 63 69 71 72 73 76 78 79 82 83 85 86 90 95 96 97 101 105 106 109 110 111 112 113 114 115 117 119 121 122 123 124 128 133 135 136 137 140 141 143 144 145 146 149 150 156 157 158 159 160 161 162 163 1...

output:

11782201

result:

ok 1 number(s): "11782201"

Test #15:

score: 0
Accepted
time: 50ms
memory: 16420kb

input:

49843
24989
0 1 2 3 5 9 11 14 15 16 17 18 25 27 30 31 32 33 34 38 39 40 44 45 46 48 49 52 54 57 58 59 66 68 69 70 71 72 75 76 78 79 80 83 84 87 88 91 92 93 96 97 100 102 105 107 109 110 112 113 118 119 123 124 126 127 129 130 131 133 136 142 149 150 152 153 155 156 157 158 159 160 162 164 165 166 16...

output:

312532889

result:

ok 1 number(s): "312532889"

Test #16:

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

input:

49999
25170
2 4 5 10 13 14 15 17 21 22 27 28 29 33 34 35 37 39 40 43 45 49 51 54 55 56 59 60 63 64 67 70 72 74 78 80 82 84 85 88 90 91 95 97 98 99 101 105 106 109 110 111 113 118 121 123 124 126 127 128 129 130 131 133 139 140 144 145 146 148 149 150 153 154 155 158 159 160 161 164 167 170 172 175 1...

output:

316155125

result:

ok 1 number(s): "316155125"

Test #17:

score: 0
Accepted
time: 114ms
memory: 24904kb

input:

99923
50029
0 1 3 4 5 7 8 9 10 11 13 14 15 17 19 20 21 22 23 27 31 32 34 36 37 39 40 41 42 44 46 47 48 49 50 52 55 59 60 62 63 64 67 68 70 74 76 79 82 83 87 89 90 93 94 95 96 103 104 107 108 109 113 114 115 116 118 122 125 126 132 133 134 136 137 141 144 145 148 149 150 151 153 156 159 160 163 168 1...

output:

1256128754

result:

ok 1 number(s): "1256128754"

Test #18:

score: 0
Accepted
time: 72ms
memory: 23340kb

input:

99971
49842
2 5 7 8 11 12 13 14 15 16 17 21 22 24 26 27 31 34 35 37 39 49 50 55 57 58 63 65 66 68 69 71 76 78 79 80 81 82 83 86 87 88 92 93 94 96 99 100 101 102 104 108 109 110 113 115 116 117 118 121 123 133 134 136 138 141 143 145 146 148 149 151 154 156 157 160 162 164 165 166 167 172 173 175 176...

output:

1241597127

result:

ok 1 number(s): "1241597127"

Test #19:

score: 0
Accepted
time: 171ms
memory: 36936kb

input:

199811
99732
1 2 3 4 5 6 8 9 11 13 14 17 20 21 22 23 26 27 28 34 35 37 39 40 41 43 46 47 50 54 56 58 60 61 63 65 68 69 73 74 78 80 82 83 84 86 91 92 93 94 95 96 97 98 101 102 104 105 108 112 118 121 122 124 128 134 142 144 147 148 152 153 154 156 157 160 163 164 165 168 169 170 173 175 176 177 180 1...

output:

4979468658

result:

ok 1 number(s): "4979468658"

Test #20:

score: 0
Accepted
time: 167ms
memory: 38768kb

input:

199933
99787
2 3 4 5 6 7 8 9 10 11 13 15 17 19 23 26 28 31 33 35 36 39 40 41 42 48 50 51 52 53 54 55 58 60 62 64 75 76 78 81 82 83 84 85 86 87 90 92 97 98 101 104 106 110 111 112 113 114 115 116 119 123 124 128 129 133 137 140 147 148 150 151 152 154 157 159 161 162 163 164 165 166 167 170 171 175 1...

output:

4981605402

result:

ok 1 number(s): "4981605402"

Test #21:

score: 0
Accepted
time: 194ms
memory: 37924kb

input:

249989
124901
2 9 13 14 15 16 18 20 21 23 26 27 28 30 32 33 34 38 40 46 47 48 50 52 55 56 57 58 59 60 61 62 63 64 66 68 69 70 71 72 76 77 78 80 81 82 83 85 86 87 88 90 91 93 95 96 97 103 108 109 111 113 115 116 118 126 127 130 132 133 135 136 138 139 142 143 145 146 148 150 152 153 154 156 157 159 1...

output:

7791216814

result:

ok 1 number(s): "7791216814"

Test #22:

score: 0
Accepted
time: 268ms
memory: 37832kb

input:

249881
124875
0 4 5 6 8 10 15 16 18 20 21 24 25 26 29 34 38 41 45 48 50 51 53 55 60 63 67 69 71 72 74 76 77 81 82 84 88 89 90 91 92 94 98 99 100 101 102 103 104 105 106 107 112 114 116 117 119 121 123 124 125 128 129 130 134 137 138 139 140 141 142 146 147 148 149 150 152 153 154 157 158 159 160 161...

output:

7829721519

result:

ok 1 number(s): "7829721519"

Test #23:

score: 0
Accepted
time: 420ms
memory: 57492kb

input:

299933
150004
0 2 3 4 5 6 9 10 11 12 14 17 19 21 22 23 24 28 29 33 37 39 40 42 43 45 46 47 50 53 54 57 60 62 63 65 66 69 71 72 73 77 78 80 81 83 85 87 88 89 90 93 95 98 100 102 103 104 106 107 111 113 117 118 119 120 122 123 124 125 127 128 129 135 136 137 140 144 145 148 155 156 157 159 162 163 166...

output:

11224161800

result:

ok 1 number(s): "11224161800"

Test #24:

score: 0
Accepted
time: 421ms
memory: 53944kb

input:

299909
149818
0 3 4 6 8 16 17 19 20 21 22 24 26 28 29 31 32 34 35 36 38 44 46 50 51 52 53 54 55 58 60 61 62 63 64 66 68 70 72 73 76 77 78 79 80 85 87 88 90 91 92 93 94 95 97 102 103 104 105 107 108 109 114 115 117 118 120 124 125 126 130 131 136 137 142 146 147 149 150 154 159 163 167 170 171 175 17...

output:

11226909297

result:

ok 1 number(s): "11226909297"

Test #25:

score: 0
Accepted
time: 381ms
memory: 61456kb

input:

399953
199665
1 2 4 6 12 16 17 18 24 29 34 35 36 37 39 40 41 45 49 50 53 54 55 56 57 60 61 64 65 66 67 70 71 72 74 75 77 79 81 82 83 84 86 87 89 90 92 93 94 96 99 100 104 105 106 107 109 110 111 114 120 122 125 126 127 129 140 141 144 148 149 151 152 153 154 156 157 159 160 161 162 163 165 171 175 1...

output:

19919663720

result:

ok 1 number(s): "19919663720"

Test #26:

score: 0
Accepted
time: 382ms
memory: 59508kb

input:

399941
199546
2 3 4 8 10 11 12 13 15 16 19 21 23 24 25 26 27 31 33 35 38 39 42 44 45 47 48 51 55 57 58 62 65 68 69 72 73 75 76 77 78 79 80 81 82 83 84 87 88 90 91 94 99 100 102 103 105 109 111 115 116 117 119 120 127 130 132 134 136 138 139 140 141 142 144 145 146 148 149 151 152 156 157 161 162 164...

output:

19959584457

result:

ok 1 number(s): "19959584457"

Test #27:

score: 0
Accepted
time: 607ms
memory: 68264kb

input:

499927
250055
0 1 6 7 8 14 15 17 19 21 25 26 28 29 30 31 32 34 35 36 37 38 40 41 42 44 45 46 47 49 51 55 57 58 59 63 69 71 73 74 75 77 79 81 82 84 89 90 92 93 94 95 97 98 102 104 105 111 113 114 117 122 125 126 127 128 129 130 134 135 136 139 141 142 144 147 148 149 150 151 152 153 154 161 162 164 1...

output:

31119189420

result:

ok 1 number(s): "31119189420"

Test #28:

score: 0
Accepted
time: 595ms
memory: 68604kb

input:

499879
250040
0 3 4 6 10 11 12 14 15 16 20 24 25 26 27 28 30 33 38 39 40 41 42 44 45 46 52 54 55 56 57 58 59 63 64 66 67 69 72 74 76 79 80 84 87 90 91 92 93 94 97 100 103 104 105 106 108 111 112 116 117 119 120 121 122 124 130 132 133 135 136 138 139 142 143 147 152 153 156 157 160 163 165 166 168 1...

output:

31239374178

result:

ok 1 number(s): "31239374178"

Test #29:

score: 0
Accepted
time: 965ms
memory: 96980kb

input:

599941
300090
0 2 6 7 8 10 13 15 17 20 21 23 24 25 27 29 31 33 38 40 41 42 47 50 51 53 54 57 61 64 70 71 72 74 75 77 81 83 84 87 88 89 94 104 105 106 109 111 112 113 116 117 118 119 121 123 124 125 127 128 133 134 136 137 138 141 144 145 149 151 153 159 160 161 162 165 167 172 173 174 177 180 181 18...

output:

45044252072

result:

ok 1 number(s): "45044252072"

Test #30:

score: 0
Accepted
time: 762ms
memory: 99400kb

input:

599927
300054
1 2 4 6 9 10 15 16 17 19 22 24 25 26 30 33 34 35 37 38 39 43 46 47 48 50 51 52 55 58 59 61 65 66 67 68 70 71 77 79 80 81 82 83 84 87 88 91 92 93 94 95 96 97 98 99 103 106 108 109 111 116 117 121 125 126 127 130 131 132 139 140 142 143 146 147 148 149 150 151 153 157 159 160 161 162 164...

output:

44898160525

result:

ok 1 number(s): "44898160525"

Test #31:

score: 0
Accepted
time: 1110ms
memory: 105036kb

input:

699817
349799
0 1 2 8 10 21 28 29 31 34 35 36 37 38 39 42 43 44 46 49 50 52 54 55 56 57 59 60 61 62 63 66 68 69 71 73 77 81 82 84 85 86 89 91 97 99 101 103 105 106 108 111 114 116 118 119 120 122 123 125 126 127 128 131 132 136 137 138 141 144 146 148 155 156 157 158 159 160 162 163 165 166 172 176 ...

output:

61262880627

result:

ok 1 number(s): "61262880627"

Test #32:

score: 0
Accepted
time: 1077ms
memory: 104408kb

input:

699943
349170
0 2 3 9 11 12 13 14 15 16 20 22 24 25 27 29 30 33 34 35 39 40 43 45 46 48 49 53 55 56 61 62 64 65 66 68 72 73 76 83 85 86 87 88 92 94 95 96 98 99 100 101 106 107 108 111 113 119 122 124 125 126 129 132 133 135 139 142 145 147 149 151 154 156 158 159 160 162 166 167 170 172 173 175 176 ...

output:

60956744195

result:

ok 1 number(s): "60956744195"

Test #33:

score: 0
Accepted
time: 1160ms
memory: 109960kb

input:

799853
400390
0 2 4 5 7 9 17 23 24 25 26 27 30 32 33 34 37 39 41 42 43 44 45 47 49 51 52 54 55 56 58 64 65 66 67 68 70 71 75 76 77 78 82 83 87 88 89 90 92 93 94 97 98 99 101 103 108 110 112 114 115 116 117 120 122 124 128 129 132 133 136 137 139 140 141 142 143 145 146 148 150 151 152 153 155 156 15...

output:

80246155990

result:

ok 1 number(s): "80246155990"

Test #34:

score: 0
Accepted
time: 1258ms
memory: 108140kb

input:

799859
399965
0 1 2 3 8 9 16 18 21 23 25 27 35 36 37 41 45 48 51 55 57 59 60 62 65 66 67 68 74 75 76 83 87 88 91 93 100 101 105 106 108 109 110 111 115 118 119 120 123 124 125 127 129 132 134 136 137 138 142 143 146 150 152 153 154 156 157 158 159 161 162 163 166 168 171 172 173 175 176 187 189 190 ...

output:

80008919954

result:

ok 1 number(s): "80008919954"

Test #35:

score: 0
Accepted
time: 1338ms
memory: 113484kb

input:

899971
449631
0 1 2 3 7 8 9 10 15 20 23 24 28 30 36 47 49 51 53 54 56 59 60 61 62 63 67 69 72 73 75 78 81 83 84 85 89 91 94 95 96 97 100 102 103 104 106 107 111 112 113 115 119 121 125 126 133 135 138 143 144 147 148 149 150 151 153 157 158 159 160 161 163 165 169 170 171 173 179 180 181 186 188 189...

output:

100941924788

result:

ok 1 number(s): "100941924788"

Test #36:

score: 0
Accepted
time: 1387ms
memory: 114688kb

input:

899981
449080
0 1 2 3 4 5 8 9 11 15 16 17 18 20 21 22 25 26 28 31 34 35 38 40 42 43 46 47 48 51 53 57 59 70 71 72 74 76 78 79 80 81 82 87 88 90 94 97 98 101 102 103 104 106 107 111 112 113 115 116 117 119 120 121 123 124 126 127 128 130 133 135 137 138 139 141 143 144 148 149 151 155 156 157 159 160...

output:

100679139285

result:

ok 1 number(s): "100679139285"

Test #37:

score: 0
Accepted
time: 1081ms
memory: 118404kb

input:

999979
500306
2 4 5 7 8 12 13 14 16 20 21 24 26 32 33 34 37 38 40 45 46 51 53 54 55 57 58 59 62 67 69 70 71 73 74 77 78 79 80 83 84 85 87 88 89 91 92 93 95 98 99 100 101 106 108 109 114 119 120 121 129 131 134 136 139 140 142 148 149 150 151 152 153 154 155 157 164 166 168 169 171 172 173 180 182 18...

output:

125164981393

result:

ok 1 number(s): "125164981393"

Test #38:

score: 0
Accepted
time: 1104ms
memory: 117748kb

input:

999953
498644
1 2 6 7 8 10 11 14 15 16 17 20 21 22 23 25 26 27 28 33 34 35 38 40 41 44 45 46 47 49 51 53 56 58 63 64 65 66 67 70 71 72 74 75 76 77 79 80 81 82 83 84 85 86 89 92 93 94 96 98 100 102 103 105 106 111 112 113 114 115 116 118 121 122 124 127 130 132 134 137 138 139 140 143 144 145 146 147...

output:

124087123229

result:

ok 1 number(s): "124087123229"

Test #39:

score: 0
Accepted
time: 1815ms
memory: 122640kb

input:

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

output:

999964000324

result:

ok 1 number(s): "999964000324"