제출 #934947

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9349472024-02-28 08:34:50MisterReaperSjeckanje (COCI21_sjeckanje)C++17
110 / 110
655 ms49236 KiB
#include <bits/stdc++.h>
using i64 = long long;
struct Info {
i64 bound[2];
i64 dp[2][2];
Info() { *this = Info(0); }
Info(i64 x) {
bound[0] = bound[1] = x;
dp[0][0] = dp[0][1] = dp[1][0] = 0;
dp[1][1] = std::abs(x);
}
};
Info operator+(Info lhs, Info rhs) {
Info res;
res.bound[0] = lhs.bound[0];
res.bound[1] = rhs.bound[1];
for(int l = 0; l < 2; l++) {
for(int r = 0; r < 2; r++) {
for(int o = 0; o < 2; o++) {
for(int m = 0; m < 2; m++) {
if(o && m) {
if((lhs.bound[1] < 0) == (rhs.bound[0] < 0)) {
res.dp[l][r] = std::max(res.dp[l][r], lhs.dp[l][o] + rhs.dp[m][r]);
}
} else {
res.dp[l][r] = std::max(res.dp[l][r], lhs.dp[l][o] + rhs.dp[m][r]);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...