提交记录 4646


用户 题目 状态 得分 用时 内存 语言 代码长度
ywx noi17a. 【NOI2017】整数 Wrong Answer 0 322.831 ms 15904 KB C++ 2.00 KB
提交时间 评测时间
2018-07-27 11:10:55 2020-07-31 23:09:47
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rint register int
#define rep(i,h,t) for (rint i=h;i<=t;i++)
#define dep(i,t,h) for (rint i=t;i>=h;i--)
#define IL inline
const int mo=1e9+7;
const int INF=1e9;
const int N=1e3+10;
int n,jc[N],jc2[N],len[N],a[N],b[N],f[N][N*2],sum[N][N*2],C[N*2][N];
struct re{
  int a,b;
}c[N];
IL bool cmp(re x,re y)
{
  return x.a<y.a;
}
void gcd(int a,int b,int &x,int &y)
{
  if (b==0)
  {
    x=1; y=0; return;
  }
  gcd(b,a%b,y,x);
  y-=x*(a/b);
}
int cnt2;
IL void js(rint &x,rint y)
{
  cnt2++;
  x+=y;
  if (x>=mo) x-=mo;
}
int main()
{
  ios::sync_with_stdio(false);
  srand(time(0)^size_t(new char));
  /*cin>>n;*/
  n=500;
  jc[0]=1;
  rep(i,1,n)
  {
    int x,y;
    gcd(i,mo,x,y);
    jc[i]=(1ll*jc[i-1]*x)%mo;
    jc2[i]=(1ll*jc2[i-1]*i)%mo;
  }
  rep(i,1,n)
  {
    //cin>>c[i*2-1].a>>c[i*2].a;
    c[i*2-1].a=rand(); c[i*2].a=rand();
    if (c[i*2-1].a>c[i*2].a) swap(c[i*2-1].a,c[i*2].a);
    c[i*2].a++;
    c[i*2-1].b=i*2-1; c[i*2].b=i*2;
  }
  sort(c+1,c+n*2+1,cmp);
  int cnt=0;
  c[0].a=INF;
  rep(i,1,n*2)
  {
    if (c[i].a!=c[i-1].a) cnt++,len[cnt]=c[i].a-c[i-1].a;
    if (c[i].b%2) a[(c[i].b+1)/2]=cnt+1;
    else b[c[i].b/2]=cnt;
  }
  int m=cnt;
  for (int i=1;i<=m;i++)
  {
    int p=1;
    C[i][0]=1;
    for (int j=1;j<=n+1;j++)
      p=(1ll*p*(len[i]+j-1))%mo,C[i][j]=((1ll*p*jc[j])%mo+mo)%mo;  
  }
  f[0][0]=1;
  rep(i,0,m) sum[i][0]=1;
  int ans=0;
  rep(i,1,n)
  {
    rep(j,a[i],b[i])
    {
      rint *ab=C[j];
      rint *ac=sum[j-1];
      rint *ad=f[j];
      rint kk=1;
      dep(k,i-1,0)
      {
        rint now=ac[k];
        rint tmp1=ad[i];
        rint tmp2=(1ll*now*ab[kk])%mo;
        if (now) js(tmp1,tmp2);
        ad[i]=tmp1;
    //    if (now) js( ad[i],(1ll*now*ab[kk])%mo);
        if (a[k]<=j&&j<=b[k]) kk++;
      }
      sum[j][i]=sum[j-1][i]+f[j][i];
      if (sum[j][i]>=mo) sum[j][i]-=mo;
      js(ans,f[j][i]);
    }
    rep(j,b[i]+1,m) sum[j][i]=sum[j-1][i];
  }
  cout<<(ans+mo)%mo<<endl;
  cout<<cnt2<<endl;
  return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1321.2 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #2322.71 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #3322.205 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #4320.518 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #5322.058 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #6322.593 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #7322.272 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #8320.615 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #9321.34 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #10321.167 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #11322.328 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #12321.63 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #13321.408 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #14322.53 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #15321.739 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #16322.817 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #17322.46 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #18322.396 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #19322.395 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #20322.831 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #21322.609 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #22321.075 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #23322.212 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #24321.646 ms15 MB + 544 KBWrong AnswerScore: 0

Testcase #25321.521 ms15 MB + 544 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-04-09 09:44:27 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠