#include "hexagon.h"
#include <bits/stdc++.h>
#include <vector>
typedef long long ll;
const ll MOD = 1000000007;
const ll low = -1000000000;
using namespace std;
ll area, bound, x, y;
int draw_territory(int N, int A, int B, vector<int> D, vector<int> L){
if(B == 0){
for(int i = 0; i < N; i++){
ll val = L[i];
bound += val;
bound %= MOD;
if(D[i] == 1){
y += val;
}
if(D[i] == 2){
area += ((2 * y * val) % MOD);
area %= MOD;
x += val;
}
if(D[i] == 3){
area += (((2 * y - val) * val) % MOD);
area %= MOD;
x += val;
y -= val;
}
if(D[i] == 4){
y -= val;
}
if(D[i] == 5){
area -= ((2 * y * val) % MOD);
area %= MOD;
x -= val;
}
if(D[i] == 6){
area -= (((2 * y + val) * val) % MOD);
area %= MOD;
x -= val;
y += val;
}
}
// cout << area << "\n";
if(area < 0) area = (MOD - (area % MOD)) % MOD;
// if(area != (L[0] * L[0])) while(1);
// cout << area << '\n';
ll inter = (area + 2 - bound);
if(inter % 2 == 1) inter = (inter + MOD) / 2;
else inter /= 2;
inter %= MOD;
return (((inter + bound) * (ll)(A)) % MOD);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
6 ms |
924 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
8 ms |
1276 KB |
Output is correct |
12 |
Correct |
9 ms |
1236 KB |
Output is correct |
13 |
Incorrect |
8 ms |
1108 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
316 KB |
Output is correct |
8 |
Correct |
2 ms |
424 KB |
Output is correct |
9 |
Correct |
6 ms |
852 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
9 ms |
1236 KB |
Output is correct |
14 |
Correct |
8 ms |
1284 KB |
Output is correct |
15 |
Incorrect |
8 ms |
1120 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |