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 i32 = int;
#define int long long
const int mod = 1e9+7;
const int inv2 = (mod+1)/2;
int dx[]={0,0,1,1,0,-1,-1},
dy[]={0,1,1,0,-1,-1,0};
i32 draw_territory(i32 N, i32 A, i32 B,
std::vector<i32> D, std::vector<i32> L) {
int X=0,Y=0;
int a=0,b=0;
for(int i=0;i<N;i++){
b+=L[i];
int nX=X+L[i]*dx[D[i]];
int nY=Y+L[i]*dy[D[i]];
a+=X*nY-Y*nX;
X=nX;Y=nY;
}
a=(abs(a)+b)%mod;
a=a*inv2%mod;
a=(a+1)%mod;
return a;
}
#undef int
# | 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... |