Google Code Jam 2021 Round 2 3問目 (10pts, 21pts)
問題文
省略
省略
C++に変換後のコードはこちら
int TEST;
int N; ll A[1d5+1];
Comb<Modint> c;
segtree<ll> t;
Modint solve(int x, int y){
int z;
if(x >= y) return 1;
z = t.getMinInd(x, y);
return solve(x,z) * solve(z+1,y) * c.C(y-x-1, z-x);
}
{
t.walloc(1d5+1);
REP(TEST,rd_int()){
wtF("Case #{TEST+1}: ");
rd(N,A(N));
rep(i,1,N) if(A[i] > A[i-1]+1) wt(0), break_continue;
t.setN(N);
rep(i,N) t[i] = A[i] * 1d9 - i;
t.build();
wt(solve(0, N));
}
}
Current time: 2024年03月19日17時29分59秒
Last modified: 2021年05月16日08時47分43秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Google_Code_Jam GCJ_2021 GCJ_2021_Round_2
トップページに戻る
Logged in as: unknown user (not login)