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 "hexagon.h"
#include <bits/stdc++.h>
#include <cstdint>
using namespace std;
#define int long long
int32_t draw_territory(int32_t N, int32_t A, int32_t B, vector<int32_t> D,
vector<int32_t> L) {
const int mod = 1e9 + 7;
int step = L[0];
int numoftrig = (L[0] + 1) * (L[0] + 2) / 2 % mod;
function<int(int, int)> logpow = [&](int a, int b) {
if (b == 0)
return 1LL;
int x = logpow(a, b / 2);
if (b % 2 == 1)
return x * x % mod * a % mod;
return x * x % mod;
};
int coefd = (step + 1) * (step + 2) % mod * (2 * step + 3) % mod *
logpow(6, mod - 2) % mod;
coefd -= numoftrig;
coefd += mod;
coefd %= mod;
return (coefd * B % mod + A * numoftrig % mod) % mod;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |