Submission #130562

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1305622019-07-15 14:33:17KieranHorganAliens (IOI16_aliens)C++17
60 / 100
2090 ms704832 KiB
#pragma GCC optimize("Ofast")
#pragma GCC targe("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int, int>> intervals;
int cost(int i, int l) {
int overlap = max(0ll, intervals[l].second-intervals[l+1].first+1);
return (intervals[i].second-intervals[l+1].first+1)*(intervals[i].second-intervals[l+1].first+1) - overlap*overlap;
}
signed n;
vector<vector<int>> dp, opt;
int j;
void recurse(int l, int r) {
if(l==r) return;
int i = (l+r)/2;
for(int cur = opt[j][l-1]; cur < (r==n+1?i:opt[j][r]+1); cur++) {
if(dp[j-1][cur] + cost(i, cur) < dp[j][i]) {
opt[j][i] = cur;
dp[j][i] = dp[j-1][cur] + cost(i, cur);
}
}
if(l+1 != r) {
recurse(l, i);
recurse(i+1, r);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

aliens.cpp:2:0: warning: ignoring #pragma GCC targe [-Wunknown-pragmas]
 #pragma GCC targe("avx,avx2,fma")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...