QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#371661#8049. Equal SumsCreditWA 1ms3684kbC++20965b2024-03-30 14:49:522024-03-30 14:49:53

Judging History

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

  • [2024-03-30 14:49:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3684kb
  • [2024-03-30 14:49:52]
  • 提交

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'