# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523575 | RaresFelix | Chessboard (IZhO18_chessboard) | C++17 | 952 ms | 4980 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.
#include <iostream>
#include <climits>
#include <tuple>
#include <vector>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define MN 167171
using namespace std;
using ll = long long;
ll n, k;
tuple<int, int, int, int> R[MN];
ll P[MN], D[MN];
ll P2[MN], D2[MN];
static inline ll calc(ll a, ll b, ll l) {
if(P[a] == 0 && P[b] == 0)
return ((D[a] * D[b] + 1) >> 1) * l * l;
if(P[a]) {
ll nrseg;
if((D[a] & 1) == 0) {
if(P2[b] <= l) nrseg = D2[b] * l + P2[b];
else nrseg = (D2[b] + 1) * l;
} else {
if(P2[b] <= l) nrseg = D2[b] * l;
else nrseg = (D2[b] - 1) * l + P2[b];
}
return calc(a - P[a], b, l) + P[a] * nrseg;
}
return calc(b, a, l);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |