QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#613270#4794. Salajucup-team4153#WA 1210ms4952kbC++201.8kb2024-10-05 13:50:502024-10-05 13:50:51

Judging History

你现在查看的是最新测评结果

  • [2024-10-05 13:50:51]
  • 评测
  • 测评结果:WA
  • 用时:1210ms
  • 内存:4952kb
  • [2024-10-05 13:50:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;using ld=long double;using ll=long long;
using pll=pair<ll,ll>;
const int M=998244353,inv2=(M+1)/2,P=20;const ld eps=1e-8,pi=acos(-1);
ll poww(ll bs,ll x){ll res=1;for(;x;x>>=1,(bs*=bs)%=M)if(x&1)(res*=bs)%=M;return res;}
ll invv(ll bs){return poww(bs,M-2);}
//step lft_node lft_ed
// -x,-x
int mod;
void add(ll&a,ll b){a+=b;if(a>=mod)a-=mod;}
struct S
{
    int n,m,El;vector<vector<ll>>dp;vector<ll>res;
    void ini()
    {
        cin>>n>>m>>mod;El=n*(n-1);n--;res.resize(m+1,0);
        dp.resize(n+1,vector<ll>(El+1,0));dp[n][0]=1;
        for(int i=1;i<=m;i++)
        {
            vector<vector<ll>>dp2(n+1,vector<ll>(El+1,0));
            for(int j=0;j<=n;j++)for(int k=0;k<=El;k++)
            {
                if(dp[j][k])
                {
                    ll v=dp[j][k];
                    add(dp2[j][k+1],v);
                    add(res[i],v);
                }
                if(j==n||k==El)
                {
                    int j2=j,k2=k;ll sum=0;
                    while(1)
                    {
                        add(sum,dp[j2][k2]);
                        j2--;k2--;if(j2<0||k2<0)break;
                        add(dp2[j2][k2],sum);
                        add(res[i],sum);
                    }
                }
            }
            swap(dp,dp2);
            //for(int j=0;j<=n;j++,cout<<'\n')for(int k=0;k<=El;k++)cout<<dp[i][j][k]<<'.';
           /// cout<<"*****\n";
        }
        for(int i=1;i<=m;i++)cout<<res[i]<<" \n"[i==m];
    }
    void solve()
    {

    }
};
signed main()
{
    cout<<fixed<<setprecision(12);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;cin>>t;
    while(t--){S SS;SS.ini();SS.solve();}
}
/*

 */

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

2
5 10 666013
6 9 10

output:

1 2 4 9 21 50 110 209 351 546
1 2 4 9 1 1 6 0 7

result:

ok 19 numbers

Test #2:

score: -100
Wrong Answer
time: 1210ms
memory: 4952kb

input:

10
31 248 8654701
13 11 331266209
33 517 52876477
26 580 675225807
48 2029 311070528
26 31 327981899
39 25 644128037
29 776 464963196
43 799 451592950
25 184 564388620

output:

1 2 4 9 21 51 127 323 835 2188 5798 15511 41835 113634 310572 853467 2356779 6536382 889882 7578514 4072343 2646977 4649285 7797829 7894657 8630011 5369867 7539674 4332126 8201689 8589675 2709364 4018535 3531401 5490003 4890382 334630 1280966 7295275 4971992 1680824 7744560 2450701 2716471 1097918 5...

result:

wrong answer 1102nd numbers differ - expected: '546820274', found: '546820275'