[C艹] 80' 后两点WA 本地无误
查看原帖
[C艹] 80' 后两点WA 本地无误
557826
D_guard楼主2022/7/26 20:32

rt,#9 #10 WA,随后下载了#9数据本地运行,答案正确

又尝试了所有变量开long long,仍WA

蒟蒻代码如下(评测记录见帖尾)

#include <cstdio>
#include <iostream>
using namespace std;
int n, m, p[2], bin[100000];
long long a, b, c, ans;
int main(){
	scanf("%d%d", &n,&m);
	scanf("%d", &p[0]);
	while(--m){
		scanf("%d", &p[1]);
		if(p[0]<p[1])
			++bin[p[0]],
			--bin[p[1]];
		else
			--bin[p[0]],
			++bin[p[1]];
		p[0] = p[1];
	}
	for(int i=1; i<n; ++i){
		scanf("%lld%lld%lld", &a,&b,&c);
		bin[i]+=bin[i-1];
		if(bin[i])
			ans+=min(bin[i]*a, c+bin[i]*b);
	}
	printf("%lld", ans);
	return 0;
}

评测记录见此

这是全开long long的评测

2022/7/26 20:32
加载中...