QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#271818#7875. Queue Sortingucup-team1321#WA 89ms4616kbC++20873b2023-12-02 14:43:262023-12-02 14:43:26

Judging History

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

  • [2023-12-02 14:43:26]
  • 评测
  • 测评结果:WA
  • 用时:89ms
  • 内存:4616kb
  • [2023-12-02 14:43:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int Mod=998244353;
int n,g[510][510],f[510][510],a[510];
int main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];
    g[0][0]=1;
    for (int i=1;i<=n;i++) {
        g[i][0]=1;
        for (int j=1;j<=n;j++) 
          for (int k=0;k<=j;k++)
            g[i][j]+=g[i-1][j-k],g[i][j]%=Mod;
    }
    int s=0;
    f[0][0]=1;
    for (int i=1;i<=n;i++) {
        for (int j=0;j<=s;j++) {
            for (int k=j;k<s;k++) 
              for (int t=0;t<a[i];t++)
                f[i][k+1+t]=(f[i][k+1+t]+1LL*f[i-1][j]*g[k-j+1][t]%Mod)%Mod;
            f[i][j]+=f[i-1][j];f[i][j]%=Mod;
        }
        s+=a[i];
    }
    int ans=0;
    for (int i=0;i<s;i++) ans=(ans+f[n][i])%Mod; 
      cout<<ans;
    return 0;
          
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3440kb

input:

4
1 1 1 1

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: -100
Wrong Answer
time: 89ms
memory: 4616kb

input:

300
0 5 2 2 1 0 3 2 2 5 2 1 1 2 1 3 2 3 2 0 0 0 0 1 2 2 3 0 2 2 3 2 0 2 3 0 6 0 0 2 0 1 3 2 1 1 1 3 4 0 1 0 4 1 1 1 1 1 1 2 3 2 1 2 3 2 3 0 5 3 3 2 0 1 1 0 2 1 1 2 0 0 2 1 1 3 2 2 1 2 1 3 0 3 0 1 2 2 0 5 0 2 2 0 0 0 1 2 1 4 2 1 1 0 3 0 2 0 3 1 1 2 0 2 1 1 0 2 0 1 2 2 3 3 1 1 1 1 0 1 3 3 1 0 2 2 4 2 ...

output:

99545473

result:

wrong answer 1st numbers differ - expected: '507010274', found: '99545473'