QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#782903 | #9651. 又一个欧拉数问题 | chenxinyang2006 | 100 ✓ | 805ms | 76824kb | C++23 | 8.8kb | 2024-11-25 22:05:20 | 2024-11-25 22:05:20 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define mem(a,b) memset(a,b,sizeof(a))
#define mpy(a,b) memcpy(a,b,sizeof(b))
#define dbg(...) cerr<<"#"<<__LINE__<<": "<<__VA_ARGS__<<endl
#define Fi(s) freopen(s,"r",stdin)
#define Fo(s) freopen(s,"w",stdout)
#define Fio(s) Fi(s".in"),Fo(s".out")
#define SZ(S) (int)S.size()
#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template<int P>
class mod_int{
using Z=mod_int;
private:
static int mo(int x){return x<0?x+P:x;}
public:
int x;
int val()const{return x;}
mod_int():x(0){}
template<class T>mod_int(const T&x_):x(x_>=0&&x_<P?static_cast<int>(x_):mo(static_cast<int>(x_%P))){}
bool operator==(const Z&rhs)const{return x==rhs.x;}
bool operator!=(const Z&rhs)const{return x!=rhs.x;}
Z operator-()const{return Z(x?P-x:0);}
Z pow(long long k)const{Z res=1,t=*this;while(k){if(k&1)res*=t;if(k>>=1)t*=t;}return res;}
Z&operator++(){x<P-1?++x:x=0;return *this;}
Z&operator--(){x?--x:x=P-1;return *this;}
Z operator++(int){Z ret=x;x<P-1?++x:x=0;return ret;}
Z operator--(int){Z ret=x;x?--x:x=P-1;return ret;}
Z inv()const{return pow(P-2);}
Z&operator+=(const Z&rhs){(x+=rhs.x)>=P&&(x-=P);return *this;}
Z&operator-=(const Z&rhs){(x-=rhs.x)<0&&(x+=P);return *this;}
Z&operator*=(const Z&rhs){x=1ULL*x*rhs.x%P;return *this;}
Z&operator/=(const Z&rhs){return *this*=rhs.inv();}
#define setO(T,o) friend T operator o(const Z&lhs,const Z&rhs){Z res=lhs;return res o##=rhs;}
setO(Z,+)setO(Z,-)setO(Z,*)setO(Z,/)
#undef setO
};
const int P = 998244353;
using Z = mod_int<P>;
ll qpow(ll x, ll k){
ll ret = 1;
while(k){
if(k & 1) (ret *= x) %= mod;
(x *= x) %= mod, k >>= 1;
}
return ret;
}
namespace Poly_space{
Z inv2 = (P + 1) / 2;
vector<int> rev;
vector<Z> gg = {0, 1};
Z rt = 3;
void setroot(Z x){rt = x;}
void dft(vector<Z> &a){
int n = a.size();
if((int)rev.size() != n){
int k = __builtin_ctz(n) - 1; rev.resize(n);
for(int i = 0; i < n; i++){rev[i] = rev[i >> 1] >> 1 | (i & 1 ? (1 << k) : 0);}
}
for(int i = 0; i < n; i++) if(i < rev[i]) swap(a[i], a[rev[i]]);
if((int)gg.size() < n){
int k = __builtin_ctz(gg.size()); gg.resize(n);
while((1 << k) < n){
Z e = rt.pow((P - 1) >> (k + 1));
for(int i = (1 << (k - 1)); i < (1 << k); i++) gg[i << 1] = gg[i], gg[(i << 1) | 1] = gg[i] * e;
k++;
}
}
for(int mid = 1; mid < n; mid <<= 1) for(int i = 0; i < n; i += (mid << 1)) for(int j = 0; j < mid; j++){
Z x = a[i + j], y = a[i + j + mid] * gg[mid + j];
a[i + j] = x + y, a[i + j + mid] = x - y;
}
}
void idft(vector<Z> &a){
int n = a.size(); reverse(a.begin() + 1, a.end()), dft(a);
Z inv = Z(1 - P) / Z(n); for(int i = 0; i < n; i++) a[i] *= inv;
}
struct Poly{
vector<Z> a;
Poly(){} Poly(const vector<Z> &x): a(x){} Poly(const initializer_list<Z> &x): a(x){}
int size()const{return a.size();} void resize(int x){a.resize(x);}
Z operator [](int ind)const{if(ind < 0 || ind >= size()) return 0; return a[ind];}
Z&operator [](int ind){return a[ind];}
Poly modxk(int k)const{k = min(k, size()); return Poly(vector<Z>(a.begin(), a.begin() + k));}
Poly mulxk(int k)const{vector<Z> b = a; b.insert(b.begin(), k, 0); return b;}
Poly divxk(int k)const{if(size() <= k) return Poly(); return Poly(vector<Z>(a.begin() + k, a.end()));}
friend Poly operator + (const Poly &a, const Poly &b){
vector<Z> ret(max(a.size(), b.size()));
for(int i = 0; i < ret.size(); i++) ret[i] = a[i] + b[i];
return Poly(ret);
}
friend Poly operator - (const Poly &a, const Poly &b){
vector<Z> ret(max(a.size(), b.size()));
for(int i = 0; i < ret.size(); i++) ret[i] = a[i] - b[i];
return Poly(ret);
}
friend Poly operator * (const Poly &a, const Z &b){
vector<Z> ret(a.size());
for(int i = 0; i < ret.size(); i++) ret[i] = a[i] * b;
return Poly(ret);
}
friend Poly operator * (Poly a, Poly b){
if(a.size() == 0 || b.size() == 0) return Poly();
int sz = 1, n = a.size() + b.size() - 1;
while(sz < n) sz <<= 1;
a.resize(sz), b.resize(sz), dft(a.a), dft(b.a);
for(int i = 0; i < sz; i++) a.a[i] = a[i] * b[i];
idft(a.a), a.resize(n); return a;
}
Poly inv(int deg)const{
if(deg == 1) return Poly({a[0].pow(P - 2)});
Poly res = inv((deg + 1) >> 1), tmp = *this;
int sz = 1; while(sz < (deg << 1)) sz <<= 1;
tmp = tmp.modxk(deg), tmp.resize(sz), res.resize(sz);
dft(tmp.a), dft(res.a);
for(int i = 0; i < sz; i++) res[i] = 2 * res[i] - res[i] * res[i] * tmp[i];
idft(res.a), res.resize(deg);
return res;
}
Poly derivative()const{
if(size() == 1) return Poly();
Poly ret(vector<Z>(size() - 1));
for(int i = 1; i < size(); i++) ret.a[i - 1] = a[i] * i;
return ret;
}
Poly integrate()const{
Poly ret(vector<Z>(size() + 1));
for(int i = 1; i < ret.size(); i++) ret.a[i] = a[i - 1] * Z(i).inv();
return ret;
}
Poly ln(int deg){
Poly res = derivative(), tmp = inv(deg);
res = (res * tmp).integrate(), res.resize(deg);
return res;
}
Poly exp(int deg){
Poly ret(vector<Z>(1)); ret[0] = 1; int i = 1;
while(i < deg) i <<= 1, ret = (ret * (Poly({1}) - ret.ln(i) + modxk(i))).modxk(i);
return ret.modxk(deg);
}
};
}
using namespace Poly_space;
Z power(Z p,ll k){
Z ans = 1;
while(k){
if(k % 2 == 1) ans *= p;
p *= p;
k /= 2;
}
return ans;
}
int n,k,up;
Z fact[100005],ifac[100005],inv[100005];
int w[1 << 3];
struct M{
Poly v[1 << 2][1 << 2];
}A,B,temp;
M mul(M a,M b,int deg){
int N = 1;
while(N <= 2 * (deg - 1)) N *= 2;
M c;
rep(S,0,up - 1){
rep(T,0,up - 1){
a.v[S][T].a.resize(deg);
b.v[S][T].a.resize(deg);
a.v[S][T].a.resize(N);
b.v[S][T].a.resize(N);
c.v[S][T].a.resize(N);
dft(a.v[S][T].a);
dft(b.v[S][T].a);
}
}
rep(S,0,up - 1){
rep(T,0,up - 1){
rep(O,0,up - 1){
rep(i,0,N - 1) c.v[S][T].a[i] += a.v[S][O].a[i] * b.v[O][T].a[i];
}
idft(c.v[S][T].a);
c.v[S][T].a.resize(deg);
}
}
return c;
}
Poly _res[1 << 2];
void matrix_inv(int deg){
if(deg == 1){
rep(S,0,up - 1){
rep(T,0,up - 1) A.v[S][T].a.resize(deg);
A.v[S][S].a[0] = 1;
}
return;
}
int hdeg = (deg + 1) / 2;
matrix_inv(hdeg);
temp = mul(A,B,deg);
rep(S,0,up - 1){
rep(T,0,up - 1){
rep(i,0,deg - 1) temp.v[S][T].a[i] *= -1;
}
temp.v[S][S].a[0] += 1;
rep(T,0,up - 1) temp.v[S][T] = temp.v[S][T].divxk(hdeg);
}
temp = mul(temp,A,deg - hdeg);
rep(S,0,up - 1){
rep(T,0,up - 1){
rep(i,0,deg - hdeg - 1) A.v[S][T].a.eb(temp.v[S][T].a[i]);
}
}
}
void slv(){
/* printf("try calc inv:\n");
rep(S,0,up - 1){
rep(T,0,up - 1){
printf("M[%d][%d]\n",S,T);
rep(i,0,n) printf("%d ",B.v[S][T].a[i].val());
printf("\n");
}
}*/
matrix_inv(n);
rep(S,0,up - 1){
rep(T,0,up - 1) _res[S] = _res[S] + A.v[S][T];
}
}
Z dp[4],ndp[4];
void trans(int p,int op){
rep(S,0,up - 1){
int msk = (S << 1) | p;
ndp[msk % (1 << (k - 2))] += dp[S] * w[msk] * op;
}
}
void strans(int p,int op){
rep(S,0,up - 1){
int msk = (S << 1) | p;
ndp[msk % (1 << (k - 2))] += dp[S] * op;
}
}
void tem(){
rep(S,0,up - 1){
dp[S] = ndp[S];
ndp[S] = 0;
// rep(i,0,k - 3) printf("%d",(S >> i) & 1);
// printf("->%d\n",dp[S].val());
}
// printf("\n");
}
int main(){
// freopen("test.in","r",stdin);
scanf("%d%d",&n,&k);
up = (1 << (k - 2));
rep(S,0,(1 << (k - 1))) scanf("%d",&w[S]);
fact[0] = 1;
rep(i,1,n) fact[i] = fact[i - 1] * i;
ifac[n] = Z(1) / fact[n];
per(i,n - 1,0) ifac[i] = ifac[i + 1] * (i + 1);
rep(i,1,n) inv[i] = ifac[i] * fact[i - 1];
rep(S,0,up - 1){
rep(T,0,up - 1) B.v[S][T].a.resize(n + 1);
B.v[S][S].a[0] += 1;
}
rep(S,0,up - 1){
fill(dp,dp + up,0);
dp[S] = 1;
rep(i,1,n){
if(i == 1){
trans(0,1);
}else{
trans(0,-1);
trans(1,1);
}
// printf("i=%d\n",i);
tem();
rep(T,0,up - 1) B.v[S][T].a[i] -= dp[T] * ifac[i];
}
}
slv();
Z answer = 0;
rep(SS,0,up - 1){
fill(dp,dp + up,0);
dp[0] = 1;
int len = 1;
Z cof = 1;
rep(i,0,k - 3){
if((SS >> i) & 1){
strans(0,-1);
strans(1,1);
cof *= inv[++len];
}else{
strans(0,1);
len = 1;
}
tem();
}
rep(i,0,(n - 1) - (k - 2)){
rep(S,0,up - 1) answer += cof * dp[S] * _res[S].a[(n - 1) - (k - 2 + i)];
trans(0,-1);
trans(1,1);
tem();
cof *= inv[++len];
}
}
answer *= fact[n];
printf("%d\n",answer.val());
cerr << clock() << endl;
return 0;
}
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 5108kb
input:
4 4 698120943 122288832 680575548 463848799 156774757 854895700 608223343 677744207
output:
129451994
result:
ok 1 number(s): "129451994"
Test #2:
score: 5
Accepted
time: 1ms
memory: 5120kb
input:
5 4 550891357 916542306 749948554 123704496 62951279 389103312 185283715 952036050
output:
603530316
result:
ok 1 number(s): "603530316"
Test #3:
score: 5
Accepted
time: 1ms
memory: 5052kb
input:
5 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 5
Accepted
time: 1ms
memory: 5360kb
input:
9 4 932794876 983187846 61110015 10089567 242406926 990649413 302889463 707289292
output:
623984278
result:
ok 1 number(s): "623984278"
Test #5:
score: 5
Accepted
time: 1ms
memory: 5096kb
input:
10 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 5
Accepted
time: 0ms
memory: 5028kb
input:
7 4 75656923 89231235 268411832 331473274 613621490 724088841 938061331 436247598
output:
828280933
result:
ok 1 number(s): "828280933"
Subtask #2:
score: 10
Accepted
Dependency #1:
100%
Accepted
Test #7:
score: 10
Accepted
time: 1ms
memory: 5136kb
input:
17 4 502378168 0 899256313 98988040 502378168 899256313 495866185 403390128
output:
955634034
result:
ok 1 number(s): "955634034"
Test #8:
score: 10
Accepted
time: 1ms
memory: 5108kb
input:
12 4 973896694 511296006 0 486948347 0 0 486948347 511296006
output:
717853738
result:
ok 1 number(s): "717853738"
Test #9:
score: 10
Accepted
time: 1ms
memory: 5368kb
input:
19 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 10
Accepted
time: 0ms
memory: 5060kb
input:
11 4 419369069 674825741 201692543 290396938 869076983 225876646 409445596 934556751
output:
579300967
result:
ok 1 number(s): "579300967"
Test #11:
score: 10
Accepted
time: 1ms
memory: 5132kb
input:
16 4 399991278 671519396 535203044 718737955 71028311 806731162 326724957 940847965
output:
842945071
result:
ok 1 number(s): "842945071"
Test #12:
score: 10
Accepted
time: 1ms
memory: 5376kb
input:
17 4 836771329 338008804 131570815 515413785 262236691 408466186 362787701 152542617
output:
293433305
result:
ok 1 number(s): "293433305"
Subtask #3:
score: 5
Accepted
Test #13:
score: 5
Accepted
time: 1ms
memory: 4988kb
input:
2 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 5
Accepted
time: 1ms
memory: 5124kb
input:
3 2 0 142044554
output:
704013496
result:
ok 1 number(s): "704013496"
Test #15:
score: 5
Accepted
time: 1ms
memory: 5084kb
input:
4 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #16:
score: 5
Accepted
time: 1ms
memory: 5084kb
input:
5 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 5
Accepted
time: 50ms
memory: 12280kb
input:
99487 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #18:
score: 5
Accepted
time: 50ms
memory: 12272kb
input:
99738 2 693173587 283412622
output:
815899210
result:
ok 1 number(s): "815899210"
Subtask #4:
score: 10
Accepted
Test #19:
score: 10
Accepted
time: 1ms
memory: 5040kb
input:
3 3 977925087 204858071 813705548 204858071
output:
225177337
result:
ok 1 number(s): "225177337"
Test #20:
score: 10
Accepted
time: 1ms
memory: 5104kb
input:
4 3 455457192 542787161 728591379 0
output:
494572650
result:
ok 1 number(s): "494572650"
Test #21:
score: 10
Accepted
time: 1ms
memory: 5108kb
input:
5 3 280102847 175353772 822890581 718141506
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 10
Accepted
time: 1ms
memory: 5152kb
input:
93 3 517938077 480306276 173009841 0
output:
132737095
result:
ok 1 number(s): "132737095"
Test #23:
score: 10
Accepted
time: 0ms
memory: 5340kb
input:
85 3 812966373 8069068 241411799 241442405
output:
835292882
result:
ok 1 number(s): "835292882"
Test #24:
score: 10
Accepted
time: 1ms
memory: 5392kb
input:
93 3 740309863 562024812 723775833 67304547
output:
79626905
result:
ok 1 number(s): "79626905"
Subtask #5:
score: 10
Accepted
Dependency #4:
100%
Accepted
Test #25:
score: 10
Accepted
time: 5ms
memory: 5568kb
input:
3204 3 390926493 321900190 164112702 172373440
output:
25228045
result:
ok 1 number(s): "25228045"
Test #26:
score: 10
Accepted
time: 1ms
memory: 5040kb
input:
118 3 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #27:
score: 10
Accepted
time: 0ms
memory: 5380kb
input:
1812 3 743708154 0 458364972 539879381
output:
369996118
result:
ok 1 number(s): "369996118"
Test #28:
score: 10
Accepted
time: 5ms
memory: 5612kb
input:
3997 3 506494422 310846999 0 0
output:
180977771
result:
ok 1 number(s): "180977771"
Test #29:
score: 10
Accepted
time: 2ms
memory: 5644kb
input:
3919 3 850826367 581870616 262788170 385598679
output:
718155036
result:
ok 1 number(s): "718155036"
Test #30:
score: 10
Accepted
time: 5ms
memory: 5556kb
input:
3908 3 268833736 15860337 13324648 101653332
output:
307317750
result:
ok 1 number(s): "307317750"
Subtask #6:
score: 15
Accepted
Dependency #5:
100%
Accepted
Test #31:
score: 15
Accepted
time: 47ms
memory: 9600kb
input:
27617 3 649538421 649538421 697411864 348705932
output:
147599656
result:
ok 1 number(s): "147599656"
Test #32:
score: 15
Accepted
time: 52ms
memory: 9328kb
input:
32594 3 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #33:
score: 15
Accepted
time: 41ms
memory: 9064kb
input:
18203 3 971232001 436685091 53582375 579077060
output:
15944343
result:
ok 1 number(s): "15944343"
Test #34:
score: 15
Accepted
time: 88ms
memory: 14876kb
input:
39024 3 761026701 107837672 107837672 129379980
output:
733762036
result:
ok 1 number(s): "733762036"
Test #35:
score: 15
Accepted
time: 90ms
memory: 14556kb
input:
39934 3 860432642 218393709 0 137811711
output:
959310258
result:
ok 1 number(s): "959310258"
Test #36:
score: 15
Accepted
time: 92ms
memory: 14516kb
input:
39441 3 647870660 428771613 299764381 537645434
output:
403002156
result:
ok 1 number(s): "403002156"
Subtask #7:
score: 5
Accepted
Dependency #6:
100%
Accepted
Test #37:
score: 5
Accepted
time: 191ms
memory: 24692kb
input:
65961 3 573372243 470586592 899656037 952529871
output:
727883299
result:
ok 1 number(s): "727883299"
Test #38:
score: 5
Accepted
time: 200ms
memory: 24524kb
input:
95856 3 657353865 0 340890488 0
output:
443504623
result:
ok 1 number(s): "443504623"
Test #39:
score: 5
Accepted
time: 98ms
memory: 14020kb
input:
43044 3 735177548 164240636 263066805 263066805
output:
357165044
result:
ok 1 number(s): "357165044"
Test #40:
score: 5
Accepted
time: 199ms
memory: 24952kb
input:
99124 3 0 626743689 688853562 309390791
output:
488790683
result:
ok 1 number(s): "488790683"
Test #41:
score: 5
Accepted
time: 208ms
memory: 23504kb
input:
99895 3 599127905 0 269443581 399116448
output:
308060904
result:
ok 1 number(s): "308060904"
Test #42:
score: 5
Accepted
time: 207ms
memory: 25012kb
input:
99441 3 81228584 583326742 103263243 128429203
output:
142331215
result:
ok 1 number(s): "142331215"
Subtask #8:
score: 10
Accepted
Dependency #2:
100%
Accepted
Test #43:
score: 10
Accepted
time: 1ms
memory: 5036kb
input:
4 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #44:
score: 10
Accepted
time: 1ms
memory: 5024kb
input:
5 4 719850794 868458999 534771757 496641034 108328567 58126453 451622145 127965210
output:
199502123
result:
ok 1 number(s): "199502123"
Test #45:
score: 10
Accepted
time: 10ms
memory: 5640kb
input:
1620 4 575012072 993907457 465640749 414558489 536940500 884536134 536940500 579348968
output:
276727543
result:
ok 1 number(s): "276727543"
Test #46:
score: 10
Accepted
time: 10ms
memory: 5684kb
input:
2000 4 583522935 653359292 238637874 720209712 120795105 906170921 202280741 436530633
output:
247950749
result:
ok 1 number(s): "247950749"
Test #47:
score: 10
Accepted
time: 10ms
memory: 5664kb
input:
1903 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #48:
score: 10
Accepted
time: 10ms
memory: 5880kb
input:
1970 4 634852705 681848099 480528749 96325370 426074420 662814695 282626889 407588785
output:
358841946
result:
ok 1 number(s): "358841946"
Subtask #9:
score: 10
Accepted
Dependency #8:
100%
Accepted
Test #49:
score: 10
Accepted
time: 375ms
memory: 39336kb
input:
35788 4 137592553 167362125 666174864 893867308 935259273 409053348 908484962 421828880
output:
317183526
result:
ok 1 number(s): "317183526"
Test #50:
score: 10
Accepted
time: 79ms
memory: 13504kb
input:
13180 4 455644004 629655674 433939914 99482062 167912374 215744296 744048010 856909532
output:
724269763
result:
ok 1 number(s): "724269763"
Test #51:
score: 10
Accepted
time: 183ms
memory: 22740kb
input:
25810 4 50511582 266090813 782665122 316602395 681641958 25053907 922678864 732153540
output:
316456760
result:
ok 1 number(s): "316456760"
Test #52:
score: 10
Accepted
time: 382ms
memory: 39684kb
input:
39626 4 0 0 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #53:
score: 10
Accepted
time: 361ms
memory: 39872kb
input:
39520 4 304751689 247786932 175360249 662006566 300713484 967876352 912150432 961654612
output:
581564252
result:
ok 1 number(s): "581564252"
Test #54:
score: 10
Accepted
time: 380ms
memory: 39788kb
input:
39654 4 199691859 32920622 161790938 562758769 16726982 895821371 135168521 518536619
output:
389091873
result:
ok 1 number(s): "389091873"
Subtask #10:
score: 20
Accepted
Dependency #9:
100%
Accepted
Test #55:
score: 20
Accepted
time: 783ms
memory: 74120kb
input:
70610 4 68292738 168290466 829953887 829953887 168290466 929951615 99997728 829953887
output:
139356701
result:
ok 1 number(s): "139356701"
Test #56:
score: 20
Accepted
time: 764ms
memory: 76824kb
input:
83154 4 40222982 0 40222982 40222982 958021371 0 877575407 0
output:
810635777
result:
ok 1 number(s): "810635777"
Test #57:
score: 20
Accepted
time: 379ms
memory: 39232kb
input:
50832 4 105333371 857557033 892910982 260281951 843295773 154948580 892910982 892910982
output:
241653357
result:
ok 1 number(s): "241653357"
Test #58:
score: 20
Accepted
time: 781ms
memory: 75844kb
input:
99201 4 259092713 0 0 811163900 446173166 552071187 739151640 187080453
output:
150187101
result:
ok 1 number(s): "150187101"
Test #59:
score: 20
Accepted
time: 805ms
memory: 74228kb
input:
99797 4 367311954 251136106 555832002 724805462 945161134 244359464 684015618 92172056
output:
25758638
result:
ok 1 number(s): "25758638"
Test #60:
score: 20
Accepted
time: 803ms
memory: 76380kb
input:
99065 4 671004682 687177570 888521328 363461538 143576590 52815535 910840671 989086834
output:
379711332
result:
ok 1 number(s): "379711332"