Submission #613874

#TimeUsernameProblemLanguageResultExecution timeMemory
613874AugustinasJucasHexagonal Territory (APIO21_hexagon)C++14
0 / 100
1 ms304 KiB
#include "hexagon.h" #include <bits/stdc++.h> using namespace std; int n = 0; const long long mod = 1e9 + 7; long long pw(long long x, long long y) { if(y == 0) return 1; auto sq = pw(x, y/2); sq = sq * sq % mod; if(y & 1) sq = sq * x % mod; return sq; } long long inv(long long x) { return pw(x, mod-2); } long long S(long long ind) { ind--; long long ret = ind*ind%mod*ind%mod; ret = (ret + 3ll*ind % mod * ind % mod) % mod; ret = (ret + 2ll * ind % mod) % mod; ret = ret * inv(3) % mod; return ret; } int draw_territory(int N, int A, int B, std::vector<int> D, std::vector<int> L) { if (n == 3) { long long side = L[0] + 1; long long area = side * (side + 1) / 2ll; long long ret = (area * A % mod + B * S(side) % mod); return ret; } return 0; }
#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...