#include "hexagon.h"
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int dx[] = {-1, 0, 1, 1, 0, -1};
int dy[] = {0, 1, 1, 0, -1, -1};
ll n, A, B;
const int MOD = 1e9 + 7;
ll power(ll a, ll b, ll p) {
ll res = 1;
while(b > 0) {
if (b & 1) res = res * a % p;
a = a * a % p;
b /= 2;
}
return res;
}
ll inv(ll a, ll p) {
return power(a, p-2, p);
}
int draw_territory(int _n, int _A, int _B, std::vector<int> d, std::vector<int> l) {
n = _n;
A = _A;
B = _B;
if (n == 3) {
ll x = l[0]+1;
ll res = (
( (x+1) * (x) / 2 % MOD * A % MOD) +
(B *
(
(x * (x+1) / 2) % MOD +
x * (x + 1) % MOD * (x + x + 1) % MOD * inv(6, MOD)
) % MOD
) % MOD
)%MOD;
return (res % MOD + MOD) % MOD;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |