QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#371661 | #8049. Equal Sums | Credit | WA | 1ms | 3684kb | C++20 | 965b | 2024-03-30 14:49:52 | 2024-03-30 14:49:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int k,e,n;
int dp[505][505][1005];
int lx[505],ly[505],rx[505],ry[505];
void solve(){
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>lx[i]>>rx[i];
}
for(int i=1;i<=m;i++){
cin>>ly[i]>>ry[i];
}
for(int i=0;i<=n;i++){
for(int j=0;j<=m;j++){
for(int k=1;k<=1000;k++){
dp[i][j][k]+=dp[i][j][k-1];
}
dp[0][0][500]=1;
for(int k=0;k<=1000;k++){
if(k<=500){
dp[i+1][j][k+lx[i+1]]+=dp[i][j][k];
dp[i+1][j][k+rx[i+1]+1]-=dp[i][j][k];
}
else{
dp[i][j+1][k-ry[j+1]]+=dp[i][j][k];
dp[i][j+1][k-ly[j+1]+1]-=dp[i][j][k];
}
}
}
}
long long int sum=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout<<dp[i][j][500]<<' ';
}
cout<<endl;
}
cout<<sum<<endl;
}
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
int t;
cin>>t;
while(t--){
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3684kb
input:
2 3 1 2 2 3 1 4 2 2 1 3
output:
0 0 0 0 0 0 0 0
result:
wrong answer 1st numbers differ - expected: '2', found: '0'