Submission #983473

#TimeUsernameProblemLanguageResultExecution timeMemory
983473bachhoangxuanHexagonal Territory (APIO21_hexagon)C++17
0 / 100
1 ms432 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...