# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080520 | alexander707070 | Hexagonal Territory (APIO21_hexagon) | C++14 | 1 ms | 348 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>
#define MAXN 100007
#include "hexagon.h"
using namespace std;
const long long mod=1e9+7;
int n;
long long ff(long long x){
long long a=x-1,b=x,c=x+1;
if(a%3==0)a/=3;
if(b%3==0)b/=3;
if(c%3==0)c/=3;
return (((a*b)%mod)*c)%mod;
}
long long ak,bk,d[MAXN],len[MAXN];
int draw_territory(int N,int A,int B,vector<int> D,vector<int> L){
n=N; ak=A; bk=B;
for(int i=1;i<=n;i++){
d[i]=D[i-1]; len[i]=L[i-1];
}
if(n==3){
return ((ak*(((len[0]+1)*(len[0]+2)/2)%mod) )%mod + (bk*ff(len[0]))%mod)%mod ;
}
}
Compilation message (stderr)
# | 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... |