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>
#define ll long long
using namespace std;
const ll mod = 1e9+7;
int draw_territory(int N, int A, int B, std::vector<int> D, std::vector<int> L) {
ll len = L[0]+1;
ll count = ((len)*(len+1))/2;
count = count%mod;
ll a1 = len-1;
ll a2 = len;
ll a3 = len+1;
if(a1%3==0){
a1 = a1/3;
} else if(a2%3==0){
a2 = a2/3;
} else {
a3 = a3/3;
}
ll d = a1*a2;
d = d%mod;
d = d*a3;
d = d%mod;
ll a = d*B;
a = a%mod;
ll b = count*A;
b = b%mod;
ll ans = a+b;
ans = ans%mod;
//cout << len << " " << count << " " << d << " " << a << " " << b << " " << ans << endl;
return ans;
}
# | 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... |