QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#312440#5146. Skillscyj20201314WA 1ms3592kbC++231.1kb2024-01-23 21:43:222024-01-23 21:43:22

Judging History

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

  • [2024-01-23 21:43:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2024-01-23 21:43:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

void solve(){
	ll n;cin>>n;
	vector<ll>s1(n+1000),s2(n+1000),s3(n+1000);
	for(int i=1;i<=n;i++)cin>>s1[i]>>s2[i]>>s3[i];
	ll d1=0,d2=0,d3=0,k1=0,k2=0,k3=0;
	for(int i=1;i<=n;i++){
		ll x=max(s1[i],max(s2[i],s3[i]));
		if(x==s1[i]){
			d1+=s1[i];
			k1=0,k2+=1,k3+=1;
			if(d2){
				ll dd2=d2;
				d2-=k2;
				if(d2<0){
					d2=0;
					k2-=dd2;
				}
			}
			if(d3){
				ll dd3=d3;
				d3-=k3;
				if(d3<0){
					d3=0;
					k3-=dd3;
				}
			}
		}else if(x==s2[i]){
			d2+=s2[i];
			k2=0,k1+=1,k3+=1;
			if(d1){
				ll dd1=d1;
				d1-=k1;
				if(d1<0){
					d1=0;
					k1-=dd1;
				}
			}
			if(d3){
				ll dd3=d3;
				d3-=k3;
				if(d3<0){
					d3=0;
					k3-=dd3;
				}
			}
		}else{
			d3+=s3[i];
			if(d2){
				ll dd2=d2;
				d2-=k2;
				if(d2<0){
					d2=0;
					k2-=dd2;
				}
			}
			if(d1){
				ll dd1=d1;
				d1-=k1;
				if(d1<0){
					d1=0;
					k1-=dd1;
				}
			}
		}
//		cout<<d1<<" "<<d2<<" "<<d3<<endl;
	}
	cout<<d1+d2+d3<<endl;
}
int main(){
	int t;cin>>t;
	while(t--)
		solve();
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

2
3
1 1 10
1 10 1
10 1 1
5
1 2 3
6 5 4
7 8 9
12 11 10
13 14 15

output:

26
42

result:

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