Submission #1063912

#TimeUsernameProblemLanguageResultExecution timeMemory
1063912kunzaZa183Hexagonal Territory (APIO21_hexagon)C++17
0 / 100
0 ms348 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...