#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#include <immintrin.h>
#pragma GCC target("avx512vl")
using namespace std;
typedef __m512i vi;
typedef long long ll;
const int N=200005;
ll dp[2][N],st[2]={100005,100005};
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
memset(dp,-'?',sizeof(dp));
dp[0][st[0]]=0;
dp[1][st[1]]=0;
for(int i=1;i<=n;i++){
int X;cin>>X;
st[i&1]--;
vi add=_mm512_set1_epi64(X);
int cur=i&1,last=cur^1;
int en=(i+1)/2;
dp[cur][st[cur]]=0;
for(int j=1;j<=en;j+=8){
vi x=_mm512_loadu_si512((vi*)&dp[cur][st[cur]+j]);
x=_mm512_add_epi64(x,add);
x=_mm512_max_epi64(x,_mm512_loadu_si512((vi*)&dp[last][st[last]+j]));
_mm512_storeu_si512((vi*)&dp[cur][st[cur]+j],x);
}
}
for(int i=1;i<=(n+1)/2;i++)cout<<dp[n&1][st[n&1]+i]<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
6740 KB |
Execution killed with signal 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
6740 KB |
Execution killed with signal 4 |
2 |
Halted |
0 ms |
0 KB |
- |