QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#312440 | #5146. Skills | cyj20201314 | WA | 1ms | 3592kb | C++23 | 1.1kb | 2024-01-23 21:43:22 | 2024-01-23 21:43:22 |
Judging History
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'