QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#345582 | #8180. Bridge Elimination | ucup-team134 | AC ✓ | 335ms | 13620kb | C++14 | 11.8kb | 2024-03-07 09:36:36 | 2024-03-07 09:36:36 |
Judging History
answer
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int mod=998244353;
inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;}
inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;}
inline int mul(int x,int y){return ((ll)x*y)%mod;}
inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;}
inline int invv(int x){return step(x,mod-2);}
namespace polynomial{
const int maxn=(1<<20);
int proot=step(3,7*17*8);
int prekw[maxn];
int prekinv[maxn];
int INF=1e9;
bool prek_flag=0;
void prek(){
if(prek_flag)return;
prek_flag=1;
prekw[0]=1;
for(int i=1;i<maxn;i++)
prekw[i]=mul(prekw[i-1],proot);
prekinv[0]=1;
for(int i=1;i<maxn;i++)prekinv[i]=mul(prekinv[i-1],i);
int curr=invv(prekinv[maxn-1]);
for(int i=maxn-1;i>0;i--){
prekinv[i]=mul(curr,prekinv[i-1]);
curr=mul(curr,i);
}
}
const int MAGIC=500;
struct polyn{
vector<int>a;
polyn(){}
polyn(vector<int>b){a=b;}
void push_back(int x){
a.pb(x);
}
int size(){return a.size();}
void resize(int n){a.resize(n);}
int& operator [](int x){
if(x>=a.size())a.resize(x+1);
return a[x];
}
polyn operator -(polyn b){
polyn ret;
ret.resize(max(b.size(),(int)a.size()));
for(int i=0;i<a.size();i++)ret[i]=add(ret[i],a[i]);
for(int i=0;i<b.size();i++)ret[i]=sub(ret[i],b[i]);
return ret;
}
polyn operator +(polyn b){
polyn ret;
ret.resize(max(b.size(),(int)a.size()));
for(int i=0;i<a.size();i++)ret[i]=add(ret[i],a[i]);
for(int i=0;i<b.size();i++)ret[i]=add(ret[i],b[i]);
return ret;
}
polyn operator *(int c){
polyn ret=(*this);
for(int i=0;i<ret.size();i++)ret[i]=mul(ret[i],c);
return ret;
}
friend polyn operator *(const int c,polyn p){
return p*c;
}
void fft(vector<int>&a,bool invert){
prek();
int n=a.size();
int j=0;
for(int i=1;i<n;i++){
int bit=n>>1;
for(;bit&j;bit>>=1)j^=bit;
j^=bit;
if(i<j)swap(a[i],a[j]);
}
for(int len=2;len<=n;len<<=1){
int hlen=len/2;
for(int i=0;i<n;i+=len){
int curr=0;
int d=maxn/len;
if(invert)d=maxn-d;
for(int j=0;j<hlen;j++){
int pom1=a[i+j];
int pom2=mul(a[i+j+hlen],prekw[curr]);
a[i+j]=add(pom1,pom2);
a[i+j+hlen]=sub(pom1,pom2);
curr+=d;
if(curr>=maxn)curr-=maxn;
}
}
}
if(invert){
int invn=invv(n);
for(int i=0;i<n;i++)a[i]=mul(a[i],invn);
}
}
polyn brute_pmul(polyn b){
polyn ret;
ret.resize(a.size()+b.size()-1);
for(int i=0;i<a.size();i++)
for(int j=0;j<b.size();j++)
ret[i+j]=add(ret[i+j],mul(a[i],b[j]));
return ret;
}
polyn operator *(polyn b){
int n=1;
while(n<(int)a.size()+(int)b.size()-1)n<<=1;
vector<int>ret=a;
if(min((int)a.size(),b.size())<MAGIC)return brute_pmul(b);
ret.resize(n);
b.resize(n);
fft(ret,0);
fft(b.a,0);
for(int i=0;i<n;i++)ret[i]=mul(ret[i],b[i]);
fft(ret,1);
return ret;
}
polyn mod_xk(int n){
polyn ret(a);
ret.resize(n);
return ret;
}
polyn mul_xk(int n){
polyn ret=(*this);
int pom=ret.size();
ret.resize(ret.size()+n);
for(int i=ret.size()-1;i>=n;i--)ret[i]=ret[i-n];
for(int i=0;i<n;i++)ret[i]=0;
return ret;
}
polyn inv(int n){
polyn bk;
assert(a[0]!=0);
bk.pb(invv(a[0]));
int sz=1;
while(sz<n){
sz<<=1;
polyn pom=((*this).mod_xk(sz)*bk).mod_xk(sz);
for(int i=0;i<pom.size();i++)pom[i]=sub(0,pom[i]);
pom[0]=add(pom[0],2);
bk=(bk*pom).mod_xk(sz);
}
return bk.mod_xk(n);
}
void reduce(){
while(a.size() && a.back()==0)a.pop_back();
}
polyn reverse(){
polyn ret(a);
std::reverse(ret.a.begin(),ret.a.end());
return ret;
}
polyn operator %(polyn b){
b.reduce();
reduce();
int n=a.size();
int m=b.size();
if(n<m){
return (*this);
}
polyn p=(reverse()*b.reverse().inv(n-m+1)).mod_xk(n-m+1).reverse();
return (*this)-p*b;
}
polyn operator /(polyn b){
b.reduce();
reduce();
int n=a.size();
int m=b.size();
if(n<m){
polyn ret;
return ret;
}
polyn p=(reverse()*b.reverse().inv(n-m+1)).mod_xk(n-m+1).reverse();
return p;
}
void build_multipoint_eval_tree(int x,int l,int r,vector<polyn>&tree,vector<int>&xp){
if(l==r){
tree[x].pb(sub(0,xp[l]));
tree[x].pb(1);
return;
}
int mid=(l+r)/2;
build_multipoint_eval_tree(x*2,l,mid,tree,xp);
build_multipoint_eval_tree(x*2+1,mid+1,r,tree,xp);
tree[x]=tree[x*2]*tree[x*2+1];
}
void multipoint_evaluate_tree(int x,int l,int r,vector<polyn>&tree,vector<int>&ret,polyn p){
p=p%tree[x];
if(l==r){
ret.pb(p[0]);
return;
}
int mid=(l+r)/2;
multipoint_evaluate_tree(x*2,l,mid,tree,ret,p);
multipoint_evaluate_tree(x*2+1,mid+1,r,tree,ret,p);
}
vector<int> multipoint_eval(vector<int>x){
vector<polyn>tree(4*x.size()+10);
build_multipoint_eval_tree(1,0,x.size()-1,tree,x);
vector<int>ret;
multipoint_evaluate_tree(1,0,x.size()-1,tree,ret,(*this));
return ret;
}
polyn integral(){
polyn ret=(*this);
prek();
ret.a.resize(a.size()+1);
for(int i=ret.a.size()-2;i>=0;i--){
ret.a[i+1]=mul(ret.a[i],prekinv[i+1]);
}
ret.a[0]=0;
return ret;
}
polyn deriv(){
polyn ret=(*this);
for(int i=0;i<ret.a.size()-1;i++){
ret.a[i]=mul(i+1,ret.a[i+1]);
}
ret.a.pop_back();
return ret;
}
polyn log(int n){
assert(a[0]==1);
return (deriv().mod_xk(n)*inv(n)).mod_xk(n).integral().mod_xk(n);
}
polyn exp(int n){
assert(a[0]==0);
int sz=1;
polyn bk;
bk[0]=1;
while(sz<n){
sz<<=1;
polyn pom=mod_xk(sz)-bk.log(sz);
pom[0]=add(pom[0],1);
bk=(bk*pom).mod_xk(sz);
}
return bk.mod_xk(n);
}
polyn shift_left(int x){
polyn ret=(*this);
for(int i=0;i+x<ret.size();i++)ret[i]=ret[i+x];
ret.resize(ret.size()-x);
return ret;
}
void ispis(){
for(int i=0;i<a.size();i++)printf("%d ",a[i]);
printf("POLYN ispis\n");
}
};
}
using namespace polynomial;
const int maxnr=410;
int fact[maxnr],inv[maxnr];
int nCk(int n,int k){
if(k<0 || n<0 || n<k)return 0;
return mul(fact[n],mul(inv[k],inv[n-k]));
}
void prek_fact(){
fact[0]=1;
for(int i=1;i<maxnr;i++)fact[i]=mul(fact[i-1],i);
inv[maxnr-1]=invv(fact[maxnr-1]);
for(int i=maxnr-1;i>0;i--)inv[i-1]=mul(inv[i],i);
}
polyn connected_graphs;
void prek_connected_graphs(){
polyn h;
for(int n=0;n<maxnr;n++){
h[n]=mul(step(2,(n*(n-1))/2),inv[n]);
///printf("%d ",h[n]);
}
connected_graphs=h.log(maxnr);
for(int i=0;i<maxnr;i++)connected_graphs[i]=mul(connected_graphs[i],fact[i]);
}
int dp_k_bridges_aux[maxnr][maxnr];
int zero_bridges[maxnr];
void prek_k_bridges(){
dp_k_bridges_aux[0][0]=1;
dp_k_bridges_aux[1][1]=1;
zero_bridges[1]=1;
for(int n=2;n<maxnr;n++){
for(int k=2;k<maxnr;k++){
for(int i=1;i<=n;i++){
int pom=mul(nCk(n,i),mul(i, mul(dp_k_bridges_aux[n-i][k-1],zero_bridges[i] ) ) );
dp_k_bridges_aux[n][k]=add(dp_k_bridges_aux[n][k], pom);
//printf("%d %d | %d | %d %d %d %d SPECIAL\n",n,k,pom,i,nCk(n,i),dp_k_bridges_aux[n-i][k-1],zero_bridges[i]);
}
dp_k_bridges_aux[n][k]=mul(dp_k_bridges_aux[n][k],invv(k));
}
int pom=connected_graphs[n];
//printf("%d %d FULL\n",n,pom);
for(int i=2;i<maxnr;i++){
pom=sub(pom, mul(dp_k_bridges_aux[n][i],step(n,i-2) ) );
//printf("%d %d | %d op\n",n,i,mul(dp_k_bridges_aux[n][i],step(n,i-2) ));
}
zero_bridges[n]=pom;
dp_k_bridges_aux[n][1]=mul(pom,n);
}
/*for(int i=1;i<maxnr;i++){
printf("%d %d\n",i,zero_bridges[i]);
}*/
}
int dp[maxnr][maxnr];
void prek_k_comps(){
dp[0][0]=1;
for(int k=1;k<maxnr;k++){
for(int n=1;n<maxnr;n++){
for(int i=1;i<=n;i++){
int pom=mul(nCk(n-k,i-1),mul(i, mul(dp[n-i][k-1],zero_bridges[i] ) ) );
dp[n][k]=add(dp[n][k], pom);
///printf("%d %d | %d | %d %d %d %d SPECIAL\n",n,k,pom,i,nCk(n-k,i-1),dp[n-i][k-1],zero_bridges[i]);
}
}
// printf("%d AA\n",k);
}
//printf("doso\n");
for(int n=1;n<maxnr;n++){
for(int k=1;k<=maxnr;k++){
if(k==1)dp[n][k]=mul(dp[n][k],invv(n));
else dp[n][k]=mul(dp[n][k],step(n,k-2));
}
}
//printf("doso\n");
}
int main(){
///freopen("test.txt","r",stdin);
prek_fact();
prek_connected_graphs();
//cout<<"opa"<<endl;
prek_k_bridges();
//cout<<"opa"<<endl;
prek_k_comps();
// cout<<"opa"<<endl;
int n;
scanf("%d",&n);
vector<int>dp2[2];
dp2[0].resize(n+1);dp2[1].resize(n+1);
int curr=0;
dp2[0][0]=1;
for(int i=1;i<=n;i++){
int a;
scanf("%d",&a);
int nxt=(curr^1);
for(int j=0;j<=n;j++)dp2[nxt][j]=0;
for(int j=0;j<=n;j++){
if(j>0)dp2[nxt][j]=mul(dp2[curr][j-1],a);
dp2[nxt][j]=add(dp2[nxt][j],dp2[curr][j]);
}
curr=nxt;
}
int rez=0;
for(int i=1;i<=n;i++){
///printf("%d | %d %d \n",i,dp2[curr][i],dp[n][i]);
rez=add(rez,mul(dp2[curr][i],dp[n][i]));
}
printf("%d\n",rez);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 326ms
memory: 13336kb
input:
3 8 5 9
output:
1102
result:
ok "1102"
Test #2:
score: 0
Accepted
time: 333ms
memory: 13608kb
input:
5 4 2 1 3 10
output:
63860
result:
ok "63860"
Test #3:
score: 0
Accepted
time: 329ms
memory: 13340kb
input:
7 229520041 118275986 281963154 784360383 478705114 655222915 970715006
output:
35376232
result:
ok "35376232"
Test #4:
score: 0
Accepted
time: 330ms
memory: 13352kb
input:
300 7 8 2 8 6 5 5 3 2 3 8 0 6 0 1 0 10 7 10 0 1 0 6 7 2 6 4 7 9 4 6 5 5 9 8 5 4 5 3 5 4 4 10 2 4 9 7 5 2 2 5 6 3 6 8 2 8 3 6 2 5 1 10 3 0 7 1 9 6 5 10 0 3 0 2 4 2 7 6 10 1 0 0 9 4 3 5 5 2 6 1 8 5 4 0 0 5 8 8 1 3 9 9 9 8 1 4 10 7 4 8 5 0 4 3 4 4 8 1 6 1 10 9 3 2 5 0 0 5 2 7 5 4 10 3 5 10 10 7 6 10 3 ...
output:
409590176
result:
ok "409590176"
Test #5:
score: 0
Accepted
time: 333ms
memory: 13316kb
input:
335 4 3 7 7 8 1 4 7 8 8 4 3 5 5 6 8 8 9 3 7 2 4 6 6 6 3 0 7 8 4 6 1 9 10 9 9 0 7 10 3 3 4 10 5 10 4 10 3 7 7 1 9 8 4 0 3 8 1 10 10 7 5 2 7 6 0 4 7 5 9 1 4 10 3 2 9 2 0 1 5 3 5 5 9 9 3 5 6 10 6 9 5 10 10 8 10 5 9 6 1 10 6 7 1 0 7 10 1 6 7 8 2 2 10 1 3 4 1 5 3 3 2 4 10 3 5 8 0 10 0 9 4 9 2 7 3 8 7 4 7...
output:
997747
result:
ok "997747"
Test #6:
score: 0
Accepted
time: 334ms
memory: 13388kb
input:
84 2 5 3 4 5 8 10 5 2 10 7 6 10 10 7 7 3 2 1 7 8 5 9 10 7 5 6 1 2 8 2 8 6 5 4 6 9 0 3 9 3 2 0 2 9 0 4 4 8 10 3 4 6 10 10 5 8 1 10 8 2 7 3 10 8 8 3 2 8 7 4 10 2 6 9 9 3 6 3 3 9 0 7 6
output:
182929290
result:
ok "182929290"
Test #7:
score: 0
Accepted
time: 334ms
memory: 13332kb
input:
54 9 2 1 10 6 6 10 4 7 6 0 3 8 10 5 7 8 6 1 10 9 6 1 8 0 4 2 7 4 0 9 8 5 3 0 4 3 6 1 8 4 1 4 9 6 6 8 0 8 0 0 7 6 9
output:
43066240
result:
ok "43066240"
Test #8:
score: 0
Accepted
time: 328ms
memory: 13608kb
input:
32 0 8 6 8 1 3 9 5 9 0 4 2 4 4 3 10 2 3 1 8 2 6 5 3 9 5 0 0 5 2 1 4
output:
718335570
result:
ok "718335570"
Test #9:
score: 0
Accepted
time: 329ms
memory: 13244kb
input:
1 998244352
output:
998244352
result:
ok "998244352"
Test #10:
score: 0
Accepted
time: 324ms
memory: 13336kb
input:
400 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244...
output:
764763555
result:
ok "764763555"
Test #11:
score: 0
Accepted
time: 333ms
memory: 13336kb
input:
85 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 9982443...
output:
360553407
result:
ok "360553407"
Test #12:
score: 0
Accepted
time: 334ms
memory: 13348kb
input:
191 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244...
output:
991556265
result:
ok "991556265"
Test #13:
score: 0
Accepted
time: 333ms
memory: 13340kb
input:
5 998244352 998244352 998244352 998244352 998244352
output:
998243313
result:
ok "998243313"
Test #14:
score: 0
Accepted
time: 330ms
memory: 13604kb
input:
1 1
output:
1
result:
ok "1"
Test #15:
score: 0
Accepted
time: 330ms
memory: 13336kb
input:
400 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 ...
output:
304058802
result:
ok "304058802"
Test #16:
score: 0
Accepted
time: 334ms
memory: 13380kb
input:
386 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 ...
output:
874115996
result:
ok "874115996"
Test #17:
score: 0
Accepted
time: 334ms
memory: 13356kb
input:
313 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 ...
output:
597837845
result:
ok "597837845"
Test #18:
score: 0
Accepted
time: 325ms
memory: 13288kb
input:
268 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 ...
output:
419739297
result:
ok "419739297"
Test #19:
score: 0
Accepted
time: 325ms
memory: 13336kb
input:
54 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
output:
643244867
result:
ok "643244867"
Test #20:
score: 0
Accepted
time: 326ms
memory: 13336kb
input:
48 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
output:
338935899
result:
ok "338935899"
Test #21:
score: 0
Accepted
time: 328ms
memory: 13332kb
input:
12 1 1 1 1 1 1 1 1 1 1 1 1
output:
530659406
result:
ok "530659406"
Test #22:
score: 0
Accepted
time: 330ms
memory: 13620kb
input:
16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
output:
873741770
result:
ok "873741770"
Test #23:
score: 0
Accepted
time: 328ms
memory: 13404kb
input:
358 1115290 857418774 525660612 441235960 968251556 195367707 499270374 150410361 311616821 559224631 56376437 943235745 210570297 973440142 173148033 156186709 113638344 240700037 220654177 232430149 10319333 895951986 632968612 969427208 953160305 662164174 33843437 666747237 34205190 811103418 41...
output:
286780900
result:
ok "286780900"
Test #24:
score: 0
Accepted
time: 333ms
memory: 13320kb
input:
344 210579027 582997879 503991744 614640417 67235757 419878515 164535437 554084256 51607125 652025880 891447125 13583488 80121136 152736049 421847155 801187930 34239618 40500488 767047613 353848772 24784010 319866280 913730443 802405315 9245074 512437704 262407695 883841184 511503173 334945884 19176...
output:
217532565
result:
ok "217532565"
Test #25:
score: 0
Accepted
time: 325ms
memory: 13352kb
input:
325 630363144 393404219 366794662 459012744 644644744 90410787 930109789 246555884 917192211 5371492 414476764 571657222 667592533 200323050 421503836 125424416 264941519 988742481 275608116 281878470 441716151 276997372 469030579 287933529 258099275 745817136 121648206 734858183 6675212 48521173 17...
output:
805089310
result:
ok "805089310"
Test #26:
score: 0
Accepted
time: 328ms
memory: 13328kb
input:
400 823489320 406308599 710963770 183707427 192930969 941365774 318564299 391028855 945374838 651744270 515755727 220857626 599403217 214957584 335628890 771694833 40989299 34892948 630275822 869708185 432704750 924850167 707864789 232688853 406616372 529994171 782650336 979286144 653704962 98275198...
output:
227120863
result:
ok "227120863"
Test #27:
score: 0
Accepted
time: 333ms
memory: 13288kb
input:
400 805673855 954340879 768398694 792304488 160627816 690839001 634355243 680917132 889295686 174793413 162216449 663827931 792641124 536196712 718524372 416336507 377989502 506596252 498339899 205499242 720836814 666357765 542341092 715613501 108264501 828631634 378880723 4945299 472651139 36366555...
output:
197153359
result:
ok "197153359"
Test #28:
score: 0
Accepted
time: 333ms
memory: 13404kb
input:
400 573858409 158564131 626297515 95107209 839325592 131488841 262394741 598473086 279712965 923126037 768477685 872125938 43550359 350073805 625331165 631979459 231780563 364979372 994161997 417207682 561100817 652033756 620534272 372707170 800776175 349668140 135175766 794164905 319904460 23767601...
output:
309947167
result:
ok "309947167"
Test #29:
score: 0
Accepted
time: 328ms
memory: 13344kb
input:
161 454284697 718044840 911733869 788445829 374976576 283555956 330659567 534673219 763772621 533686340 997431381 315009839 801324614 867648208 840434404 84390366 444646874 652727596 245127393 429009611 491221735 782941712 766298213 670004861 389539042 58372655 501168063 678515082 901575199 7964062 ...
output:
871565443
result:
ok "871565443"
Test #30:
score: 0
Accepted
time: 332ms
memory: 13340kb
input:
162 151292163 943012123 167343147 819676643 584819196 603260437 344227100 217480474 257123917 755733732 306150953 58563430 585700931 430100762 23364684 779598621 281842628 501243718 739611077 892539286 74267401 75305112 125317256 859095786 751541515 405943984 918972027 808877799 705127200 721405494 ...
output:
273432531
result:
ok "273432531"
Test #31:
score: 0
Accepted
time: 332ms
memory: 13288kb
input:
286 600838530 575651850 385279426 475664485 619069265 780822783 860939782 184686123 193863774 466950919 765401970 705574987 282843644 717393988 375193483 210523577 335822289 399592519 691770149 949281236 374732311 386267435 94137955 739197796 853274439 85692571 391770291 584612694 455182007 64033146...
output:
581998699
result:
ok "581998699"
Test #32:
score: 0
Accepted
time: 326ms
memory: 13348kb
input:
61 453833616 501467684 4992671 214825639 871776849 218199413 42498305 303731723 912156523 129282295 439845605 182960525 185237067 162024603 36559317 688854981 935232225 246423320 92982685 695989722 630828913 551225463 167009365 765939546 822255011 178394229 882957486 3774194 362820770 200498412 9203...
output:
455579427
result:
ok "455579427"
Test #33:
score: 0
Accepted
time: 328ms
memory: 13352kb
input:
25 900307596 286223988 229751451 948490346 250323590 175633754 171483351 707853698 603512678 51411170 126676903 326582510 111531585 521302732 467030281 284302822 453471425 898992972 344271140 632092014 841124127 159268130 234849517 332336122 538047172
output:
641428561
result:
ok "641428561"
Test #34:
score: 0
Accepted
time: 332ms
memory: 13348kb
input:
50 893955548 5432673 340595831 583427119 94992225 787645123 311038284 546749098 933218937 561482178 527027577 871516321 329687526 96875316 862464008 320975040 435140352 951500073 831730146 242883780 961810021 310011134 441489680 217976348 203907166 525210038 295522145 713990656 44280374 492792810 10...
output:
474987173
result:
ok "474987173"
Test #35:
score: 0
Accepted
time: 335ms
memory: 13348kb
input:
17 726738121 723815755 532257301 649033140 817058831 665912348 585846647 472719308 53020833 679093694 601943548 536712177 917063040 137577090 676474390 447455603 55046910
output:
205253339
result:
ok "205253339"
Test #36:
score: 0
Accepted
time: 329ms
memory: 13332kb
input:
13 319526944 707203324 397137993 712092752 253972256 682960643 636749775 764641774 359483944 695780350 619279205 717907790 322375408
output:
301609478
result:
ok "301609478"
Test #37:
score: 0
Accepted
time: 328ms
memory: 13620kb
input:
15 673123463 250231589 715576329 413978055 995958701 401244843 682058967 349009605 504949036 838330837 739330277 480154478 764761812 434210368 470676772
output:
460419982
result:
ok "460419982"
Extra Test:
score: 0
Extra Test Passed