Submission #979688

#TimeUsernameProblemLanguageResultExecution timeMemory
979688c2zi6Hexagonal Territory (APIO21_hexagon)C++14
3 / 100
1 ms436 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "hexagon.h" const ll MOD = 1e9 + 7; ll binpow(ll a, ll b) { if (b == 0) return 1; if (b & 1) return a*binpow(a, b-1) % MOD; ll ret = binpow(a, b/2); return ret*ret % MOD; } ll inv(ll x) { return binpow(x, MOD-2); } ll sum(ll n) { return n*(n+1) % MOD * inv(2) % MOD; } ll sumsq(ll n) { return n * (2*n+1) % MOD * (n+1) % MOD * inv(6) % MOD; } int draw_territory(int N, int A, int B, VI D, VI L) { ll x = L[0]; return sum(x+1) * (ll)A % 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...