#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cut[300002],N,K;
ll pro(int loc)
{
ll tot=0,dep=1ll<<54;
for(int i=loc;i<N-2;i+=2)
tot+=(cut[i+2]-cut[i])*(dep=min(dep,cut[i+1]));
dep=1ll<<54;
for(int i=loc;i>0;i-=2)
tot+=(cut[i]-cut[i-2])*(dep=min(dep,cut[i-1]));
return tot;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin>>N;
int i;
ll aA[2];
for(i=0;i<N;i++)
{
cin>>aA[0]>>aA[1];
cut[i]=aA[i&1];
}
cin>>K;
ll fl=0;
for(i=0;i<N;i+=2)fl=max(fl,pro(i));
printf("%lld",fl);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
544 KB |
Output is correct |
4 |
Correct |
3 ms |
552 KB |
Output is correct |
5 |
Correct |
3 ms |
564 KB |
Output is correct |
6 |
Correct |
3 ms |
592 KB |
Output is correct |
7 |
Correct |
2 ms |
672 KB |
Output is correct |
8 |
Correct |
3 ms |
684 KB |
Output is correct |
9 |
Correct |
4 ms |
696 KB |
Output is correct |
10 |
Correct |
2 ms |
792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
828 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1060 ms |
2788 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1063 ms |
2876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1073 ms |
2876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |