#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#include "hexagon.h"
const ll MOD = 1e9 + 7;
ll nr(ll x) {
x %= MOD;
x += MOD;
x %= MOD;
return x;
}
ll binpow(ll x, ll y) {
x = nr(x);
ll res = 1;
while (y > 0) {
if (y % 2 == 1)
res = nr(res * x);
x = nr(x * x);
y /= 2;
}
return res;
}
ll inv(ll x) {
return binpow(x, MOD - 2);
}
int N;
ll A, B;
vi D, L;
int draw_territory(int N_g, int A_g, int B_g, vector<int> D_g, vector<int> L_g) {
N = N_g; A = A_g; B = B_g;
for (int x : D_g)
D.pb(x);
for (int x : L_g)
L.pb(x);
ll x1 = nr(nr((L[0] + 1) * (L[0] + 2)) * inv(2));
ll x2 = nr(nr(nr(L[0] * (L[0] + 1)) * (L[0] + 2)) * inv(3));
// cout<<"x1, x2: "<<x1<<" "<<x2<<endl;
return nr(x1 * A + x2 * B);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |