# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
536501 | smessaris | Hexagonal Territory (APIO21_hexagon) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "hexagon.h"
#define pb push_back
#define ios ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int MAX = 2e5 + 5;
int draw_territory(int N, int A, int B,vector<int> D, vector<int> L){
ll ans = ((((L[0] + 1) * 1LL * (L[0] + 2)) / 2) % MOD);
ans *= A;
ans %= MOD;
for(int i=0,i<(L[0] + 1);i++){
ans += (((i * (i + 1)) % INF) * B) % MOD;
ans %= MOD;
}
sort(all(L));
assert(L[0] == L.back());
return ans;
}