Submission #566595

#TimeUsernameProblemLanguageResultExecution timeMemory
566595josanneo22Hexagonal Territory (APIO21_hexagon)C++17
9 / 100
1810 ms468 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9+7; #define FOR(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define f first #define s second #define all(x) (x).begin(), (x).end() #include "hexagon.h" int draw_territory(int N, int A, int B,std::vector<int> D, std::vector<int> L){ ll ans = ((((L[0] + 1) * 1LL * (L[0] + 2)) / 2) % mod); ans *= A; ans %= mod; if(B==0) return ans; FOR(i,0,L[0] + 1) { ans += (((i * (i + 1)) % mod) * B) % mod; ans %= mod; } sort(all(L)); assert(L[0] == L.back()); return 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...