# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130556 | KieranHorgan | Aliens (IOI16_aliens) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("0fast")
#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);
}
}
long long take_photos(signed N, signed m, signed k, vector<signed> r, vector<signed> c) {
n=N;
for(int i = 0; i < n; i++) {
if(c[i] >= r[i])
intervals.push_back({r[i], -c[i]});
else
intervals.push_back({c[i], -r[i]});
}
sort(intervals.begin(), intervals.end());
auto interStore = intervals;
intervals.clear();
intervals.push_back({-1, -1});
int ma = -1;
for(auto p: interStore) {
if(-p.second > ma) {
ma = -p.second;
intervals.push_back({p.first, -p.second});
}
}
n = intervals.size()-1;
k = min(k, n);
dp.assign(k+1, vector<int>(n+1, 1ll<<60));
opt.assign(k+1, vector<int>(n+1, 0));
dp[0][0] = 0;
// queue<pair<int, int>> ranges;
for(j = 1; j <= k; j++) {
recurse(1ll, (int)n+1);
}
return dp[k][n];
}
Compilation message (stderr)
aliens.cpp:1:29: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' #pragma GCC optimize("0fast") ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:60:0, from /usr/include/c++/7/vector:60, from aliens.h:3, from aliens.cpp:2: /usr/include/c++/7/bits/functexcept.h:48:59: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_bad_exception(void) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:48:59: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:52:55: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_bad_alloc(void) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:52:55: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:56:54: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_bad_cast(void) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:56:54: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:59:56: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_bad_typeid(void) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:59:56: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:63:64: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_logic_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:63:64: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:66:65: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_domain_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:66:65: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:69:69: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_invalid_argument(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:69:69: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:72:65: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_length_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:72:65: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:75:65: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_out_of_range(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:75:65: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:79:53: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __attribute__((__format__(__gnu_printf__, 1, 2))); ^ /usr/include/c++/7/bits/functexcept.h:79:53: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:82:66: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_runtime_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:82:66: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:85:64: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_range_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:85:64: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:88:67: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_overflow_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:88:67: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:91:68: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_underflow_error(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:91:68: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:95:64: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_ios_failure(const char*) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:95:64: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:98:57: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_system_error(int) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:98:57: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:101:57: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_future_error(int) __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:101:57: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/bits/functexcept.h:105:59: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __throw_bad_function_call() __attribute__((__noreturn__)); ^ /usr/include/c++/7/bits/functexcept.h:105:59: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' In file included from /usr/include/c++/7/bits/stl_algobase.h:61:0, from /usr/include/c++/7/vector:60, from aliens.h:3, from aliens.cpp:2: /usr/include/c++/7/bits/cpp_type_traits.h:408:32: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __miter_base(_Iterator __it) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:62:0, from /usr/include/c++/7/vector:60, from aliens.h:3, from aliens.cpp:2: /usr/include/c++/7/ext/type_traits.h:152:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __is_null_pointer(_Type* __ptr) ^ /usr/include/c++/7/ext/type_traits.h:157:28: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __is_null_pointer(_Type) ^ /usr/include/c++/7/ext/type_traits.h:162:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __is_null_pointer(std::nullptr_t) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:59:0, from /usr/include/c++/7/vector:60, from aliens.h:3, from aliens.cpp:2: /usr/include/c++/7/bits/move.h:47:27: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT ^ In file included from /usr/include/c++/7/bits/move.h:54:0, from /usr/include/c++/7/bits/stl_pair.h:59, from /usr/include/c++/7/bits/stl_algobase.h:64, from /usr/include/c++/7/vector:60, from aliens.h:3, from aliens.cpp:2: /usr/include/c++/7/type_traits:74:45: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' constexpr operator value_type() const noexcept { return value; } ^~~~~~~~ /usr/include/c++/7/type_traits:79:47: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' constexpr value_type operator()() const noexcept { return value; } ^~~~~~~~ /usr/include/c++/7/type_traits:762:56: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' typename add_rvalue_reference<_Tp>::type declval() noexcept; ^~~~~~~~ /usr/include/c++/7/type_traits:762:56: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/type_traits:788:34: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:791:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:836:19: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __test(int); ^ /usr/include/c++/7/type_traits:839:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:879:34: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:882:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:940:34: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:943:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:974:34: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:977:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:1091:34: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:1094:35: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:1261:12: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __test(int); ^ /usr/include/c++/7/type_traits:1265:12: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __test(...); ^ /usr/include/c++/7/type_traits:1377:36: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static void __helper(const _Tp&); ^ /usr/include/c++/7/type_traits:1381:68: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' decltype(__helper<const _Tp&>({}))* = 0); ^ /usr/include/c++/7/type_traits:1383:33: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:1526:29: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static void __test_aux(_To1); ^ /usr/include/c++/7/type_traits:1531:12: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __test(int); ^ /usr/include/c++/7/type_traits:1535:12: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' __test(...); ^ /usr/include/c++/7/type_traits:2184:51: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' : std::declval<_Up>())>::type> _S_test(int); ^ /usr/include/c++/7/type_traits:2187:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2200:60: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __success_type<typename _Tp::type> _S_test(int); ^ /usr/include/c++/7/type_traits:2203:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2249:66: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static typename add_rvalue_reference<_Tp>::type __delegate(); ^ /usr/include/c++/7/type_traits:2254:15: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' declval() noexcept ^~~~~~~~ /usr/include/c++/7/type_traits:2286:42: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' ), __invoke_memfun_ref> _S_test(int); ^ /usr/include/c++/7/type_traits:2289:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2305:44: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' ), __invoke_memfun_deref> _S_test(int); ^ /usr/include/c++/7/type_traits:2308:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2324:42: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' ), __invoke_memobj_ref> _S_test(int); ^ /usr/include/c++/7/type_traits:2327:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2343:44: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' ), __invoke_memobj_deref> _S_test(int); ^ /usr/include/c++/7/type_traits:2346:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2429:37: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' ), __invoke_other> _S_test(int); ^ /usr/include/c++/7/type_traits:2432:40: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static __failure_type _S_test(...); ^ /usr/include/c++/7/type_traits:2579:53: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' is_nothrow_move_assignable<_Tp>>::value); ^ /usr/include/c++/7/type_traits:2579:53: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/type_traits:2585:48: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' noexcept(__is_nothrow_swappable<_Tp>::value); ^ /usr/include/c++/7/type_traits:2585:48: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' /usr/include/c++/7/type_traits:2594:36: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:2597:37: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:2605:21: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' > __test(int); ^ /usr/include/c++/7/type_traits:2608:37: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:2674:36: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static true_type __test(int); ^ /usr/include/c++/7/type_traits:2677:37: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:2687:21: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' > __test(int); ^ /usr/include/c++/7/type_traits:2690:37: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' static false_type __test(...); ^ /usr/include/c++/7/type_traits:2767:52: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' constexpr bool __call_is_nt(__invoke_memfun_ref) ^ /usr/include/c++/7/type_traits:2775:54: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' constexpr bool __call_is_nt(__invoke_memfun_deref) ^ /usr/include/c++/7/type_traits:2782:52: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast' constexpr bool __call_is_nt(__invoke_memobj_ref) ^ /usr/include/c++/7/type_traits:2789:54: error: argument to '-O' should be a non-negative integer, 'g', 's' o