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"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define PI 3.1415926535897932384626433
#define all(s) s.begin(),s.end()
const ll mod=1e9+7;
int draw_territory(int N,int A,int B,vector<int>D,vector<int>L){
ll ans=(L[0]+1ll)*(L[0]+2ll)/2%mod;
ans=ans*A%mod;
ll p[4];
p[0]=L[0];
p[1]=L[0]+1;
p[2]=L[0]*2+1;
for(ll i=2;i<=3;i++){
for(ll j=0;j<3;j++){
if(p[j]%i==0){
p[j]/=i;
break;
}
}
}
ll cur=(L[0]+0ll)*(L[0]+1ll)/2%mod;
cur=(cur+(p[0]*p[1]%mod*p[2]%mod))%mod;
cur=cur*B%mod;
ans=(ans+cur)%mod;
return (int)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... |