记录编号 | 201690 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | [ZLXOI 2015]沼跃鱼数列变换 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.045 s | ||
提交时间 | 2015-10-31 07:41:11 | 内存使用 | 1.15 MiB | ||
#include<cstdio> using namespace std; const int SIZEN=100010,MOD=9999997; typedef long long LL; int N,M; int A[SIZEN]; int C[SIZEN]; bool H[SIZEN]={0}; void read() { scanf("%d",&N); for(int i=1;i<=N;i++) scanf("%d",&A[i]); scanf("%d",&M); for(int i=1;i<=M;i++) { scanf("%d",&C[i]); H[C[i]]=1; } } void work() { LL ans=0; for(int i=1;i<=N;i++) if(H[i]==0) { ans+=(LL)A[i]+(A[i]*ans)%MOD; ans%=MOD; } LL tem=0; for(int i=1;i<=N;i++) { if(H[i]==1) { tem+=(LL)A[i]+(A[i]*ans)%MOD; tem%=MOD; } } ans+=tem; ans%=MOD; printf("%lld",ans); } int main() { freopen("Marshtomp.in","r",stdin); freopen("Marshtomp.out","w",stdout); read(); work(); return 0; }