Submission #980372

#TimeUsernameProblemLanguageResultExecution timeMemory
980372vjudge1Hexagonal Territory (APIO21_hexagon)C++17
9 / 100
1 ms600 KiB
#include "hexagon.h" #include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; long long pw(long long x, long long n) { long long res = 1; while (n > 0) { if (n & 1) { res = res * x % mod; } n /= 2; x = x * x % mod; } return res; } int draw_territory(int N, int A, int B, std::vector<int> D, std::vector<int> L) { long long X, Y; if (N == 3) { assert (L[0] == L[1]); assert (L[1] == L[2]); long long x = L[0] + 1; X = x * (x + 1) / 2; Y = x * (x + 1) % mod * (2 * x + 1) % mod * pw(6, mod - 2) - X; } else { X = 0; Y = 0; } X %= mod; Y %= mod; long long res = X * A % mod + Y * B % mod; res = (res % mod + mod) % mod; return res; }
#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...