Submission #569297

#TimeUsernameProblemLanguageResultExecution timeMemory
569297anmichiHexagonal Territory (APIO21_hexagon)C++17
0 / 100
1 ms212 KiB
#include "hexagon.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() template <class T, class U> inline bool chmax(T& a, U b) { if (a < b) { a = b; return true; } return false; } template <class T, class U> inline bool chmin(T& a, U b) { if (a > b) { a = b; return true; } return false; } constexpr int INF = 1000000000; constexpr ll llINF = 3000000000000000000; constexpr int mod = 1000000007; const ll half = (mod + 1) / 2; constexpr double eps = 1e-10; ll modinv(ll a, ll m = mod) { ll b = m, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } constexpr int dx[] = {1, 1, 0, -1, -1, 0}, dy[] = {1, 0, -1, -1, 0, 1}; int draw_territory(int n, int a, int b, vector<int> d, vector<int> l) { if (n == 3) { ll s = l[0] - 2; ll resa = a * (s * (s + 1) / 2 % mod) % mod; s++; ll resb = (s % mod * (s + 1) % mod * (2 * s + 1) % mod * modinv(6) - 1) % mod * b % mod; return (resa + resb) % mod; } return 0; }
#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...