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 "hexagon.h"
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;
#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)
int t, n;
vi a, b;
ll mpow(ll a, ll b){
if(b==0) return 1;
if(b==1) return a;
ll z = mpow(a, b/2);
z*=z;
z%=MOD;
if(b%2) z*=a;
return z%MOD;
}
ll modinv(ll x){
return mpow(x, MOD-2);
}
int draw_territory(int N, int A, int B,
std::vector<int> D, std::vector<int> L) {
ll ans = L[0] + 1;
ans *= L[0] + 2;
ans %= MOD;
ans *= modinv(2);
ans %= MOD;
ans *= A;
ans %= MOD;
//cout<<ans<<endl;
ll ans2 = 0;
ans2 = L[0];
ans2 *= L[0] + 1;
ans2 %= MOD;
ans2 *= 2 * L[0] + 1;
ans2 %= MOD;
ans2 *= modinv(6);
ans2 %= MOD;
//cout<<ans2<<endl;
ll ans3=0;
ans3 = L[0];
ans3 *= L[0] + 1;
ans3 %= MOD;
ans3 *= modinv(2);
ans3 %= MOD;
ans2 += ans3;
ans2 %= MOD;
//cout<<ans2<<endl;
ans2 *= B;
ans2 %= MOD;
return (ans + ans2)%MOD;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |