# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41573 | cheater2k | Chessboard (IZhO18_chessboard) | C++14 | 1863 ms | 2288 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 <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k, nrec;
int lx[N], ly[N], rx[N], ry[N];
long long ans = 1e18;
int get(int t, int l, int r) {
// count the number of x such that l <= x <= r and (x / k) % 2 == t
if (l / k == r / k) {
if ((l / k) % 2 == t) return r - l + 1; else return 0;
}
int ret = 0;
if ((l / k) % 2 == t) ret += ((l / k) + 1) * k - l;
if ((r / k) % 2 == t) ret += r - (r / k) * k + 1;
l = (l / k) + 1;
r = (r / k) - 1;
if (l % 2 != t) ++l;
if (r % 2 != t) --r;
ret += max(0, (r - l) / 2 + 1) * k;
return ret;
}
# | 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... |