#include <bits/stdc++.h>
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define pll pair<ll,ll>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 2e9+5
#define eps 1e-7
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
#define V 450
using namespace std;
const int MOD = 1e9+7;
const int nax = 2e5+5;
const int lg = 20;
//#include "hexagon.h"
int add(int a, int b){
a += b;
while(a > MOD) a -= MOD;
while(a < 0) a += MOD;
return a;
}
int sub(int a, int b){
return add(a, MOD-b);
}
int mul(int a, int b){
return (a*1ll*b)%MOD;
}
int binpow(int x, int y){
int z = 1;
while(y > 0){
if(y%2 == 1) z = mul(x, z);
x = mul(x,x);
y /= 2;
}
return z;
}
int inv(int a){
return binpow(a, MOD-2);
}
int divide(int a, int b){
return mul(a,inv(b));
}
int y[6] = {2,1,-1,-2,-1,1};
int x[6] = {0,1,1,0,-1,-1};
set<int> cur[nax*2];
int draw_territory(int n, int a, int b, vi d, vi l){
int curx = nax, cury = 0, mx = nax, mn = nax;
cur[curx].insert(cury);
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < l[i]; ++j)
{
curx += x[d[i]-1], cury += y[d[i]-1];
cur[curx].insert(cury);
mx = max(mx, curx);
mn = min(mn, curx);
}
}
int res = 0;
for (int i = mn; i <= mx; ++i)
{
int lst = -INF, aff = 0;
for(auto x : cur[i]){
if(lst == -INF){
lst = x;
} else {
res = add(res, divide(sub(x,lst),2)+1);
aff = add(aff, divide(sub(x,lst),2)+1);
lst = -INF;
}
}
if(lst != -INF) res = add(res, 1);
}
return mul(a,res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
53 ms |
57420 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
40 ms |
57508 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
19028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
28008 KB |
Output is correct |
2 |
Incorrect |
36 ms |
24660 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
42 ms |
57472 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
19092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
42 ms |
57556 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
19028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |