ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214450 | #2767. 摆烂 | White_Wat | 0 | 933ms | 48092kb | C++11 | 679b | 2024-11-18 22:04:21 | 2024-11-19 08:37:19 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 2e6+6;
const long long inf = 2e18;
typedef long long ll;
int n;
int cnt;
struct node{
ll t,h;
}a[N];
ll f[N];
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n;
int last=-1,mx=0;
for(int i=1;i<=n;i++){
int t,h;cin>>t>>h;
if(t==last) mx=max(h,mx);
else{
if(last!=-1) a[++cnt]={last,mx};
last=t,mx=h;
}
}
a[++cnt]={last,mx};
// for(int i=1;i<=cnt;i++)
// cout<<a[i].t<<' '<<a[i].h<<'\n';
for(int i=1;i<=n;i++){
f[i]=inf;
f[i]=min(max(f[i-1],a[i].t)+2*a[i].h,(i>1?max(a[i].h,a[i-1].h)*2+a[i].t:inf));
}
cout<<f[n];
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1256kb
input:
20 12513359 382258501 49946422 294259408 61782741 259996549 128874560 457675284 152578248 511428369 ...
output:
1585778962
result:
wrong answer 1st numbers differ - expected: '2781551734', found: '1585778962'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 1284kb
input:
1000 132699 718470029 234343 395421925 1290414 393017296 1399642 607415822 1402810 515471990 2008288...
output:
2847383296
result:
wrong answer 1st numbers differ - expected: '2991845504', found: '2847383296'
Subtask #3:
score: 0
Wrong Answer
Test #20:
score: 0
Wrong Answer
time: 18ms
memory: 3596kb
input:
100000 9326 430414358 13368 156324232 15149 550951304 22296 345034579 22578 397947033 37137 49312905...
output:
0
result:
wrong answer 1st numbers differ - expected: '2999984291', found: '0'
Subtask #4:
score: 0
Wrong Answer
Test #32:
score: 0
Wrong Answer
time: 376ms
memory: 48092kb
input:
2000000 181 24185667 293 532288461 1433 921996635 1694 629544979 2540 173534643 2662 963172401 3159 ...
output:
0
result:
wrong answer 1st numbers differ - expected: '2999999604', found: '0'
Subtask #5:
score: 0
Wrong Answer
Test #42:
score: 0
Wrong Answer
time: 539ms
memory: 48088kb
input:
2000000 684 624071334 1181 709831992 1397 43325781 1938 430417709 4157 60566309 4568 912818933 5265 ...
output:
0
result:
wrong answer 1st numbers differ - expected: '2999999891', found: '0'