QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#278763#7875. Queue Sortingucup-team073#WA 22ms5656kbC++20602b2023-12-07 20:20:272023-12-07 20:20:28

Judging History

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

  • [2023-12-07 20:20:28]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:5656kb
  • [2023-12-07 20:20:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
constexpr int mod=998244353;

int a[510],sum[510],f[510][510],n,m;
signed main(){
  cin>>n;
  for(int i=1;i<=n;++i)cin>>a[i],sum[i]=sum[i-1]+a[i],m+=a[i];
  for(int i=1;i<=n;++i)if(a[i])f[1][i]=1;
  for(int i=2;i<=m;++i){
    for(int j=1;j<=n;++j){
      for(int k=j;k<=n;++k){
        if(!a[k])continue;
        if(k==j&&i>sum[j])continue;
        f[i][k]=(f[i][k]+f[i-1][j])%mod;
      }
    }
  }
  //for(int i=1;i<=m;++i)for(int j=1;j<=n;++j)cout<<i<<' '<<j<<' '<<f[i][j]<<endl;
  cout<<f[m][n];
  return 0;
}

详细

Test #1:

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

input:

4
1 1 1 1

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: -100
Wrong Answer
time: 22ms
memory: 5656kb

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:

743572928

result:

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