Submission #718621

#TimeUsernameProblemLanguageResultExecution timeMemory
718621lamHexagonal Territory (APIO21_hexagon)C++14
9 / 100
1 ms468 KiB
#include "hexagon.h" #include <bits/stdc++.h> #include <vector> #define ll long long using namespace std; const ll mod = 1e9 + 7; ll ppow(ll x, ll y) { ll temp = 1LL; while (y>0) { if (y&1) temp=temp*x%mod; x=x*x%mod; y/=2; } return temp; } int32_t draw_territory(int32_t N, int32_t A, int32_t B, std::vector<int32_t> D, std::vector<int32_t> L) { ll dist = L[0]; ll ans = dist*(dist+2)%mod*(dist+1)%mod*ppow(3LL,mod-2)%mod*B%mod; assert(L[0]==L[1]&&L[1]==L[2]); ll ans1 = (dist+1)*(dist+2)%mod*ppow(2ll,mod-2)%mod*A%mod; ans=(ans+ans1)%mod; return int(ans); }
#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...