QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141160#6525. New Housescy1999WA 4ms15088kbC++508b2023-08-17 09:08:152023-08-17 09:08:16

Judging History

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

  • [2023-08-17 09:08:16]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:15088kb
  • [2023-08-17 09:08:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int const maxn = 5e5+10;
#define int long long

int dp[maxn*2];
int a[maxn],b[maxn];

signed main(){
	int t;
	cin >> t ;
	while(t--){
		int n,m;
		cin >> n >> m ;
		for(int i = 1;i <= n;i ++){
			cin >>a[i] >> b[i];
		}
		memset(dp,0,sizeof dp);
		int j ,i;
		i = 1;
		for( j = 1;j <= m&&i <= n;j ++){
			dp[j] = max(dp[j-1] + a[i],dp[max(j-2,0ll)] + b[i]);
			i++;
		}
		cout <<max(dp[j-1] ,dp[max(j-2,0ll)] )<<'\n';
	}
	
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 15088kb

input:

3
4 5
1 100
100 1
100 1
100 1
2 2
1 10
1 10
2 3
100 50
1 1000

output:

400
11
1000

result:

wrong answer 2nd numbers differ - expected: '2', found: '11'