답안 #570505

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
570505 2022-05-30T10:10:28 Z grt 육각형 영역 (APIO21_hexagon) C++17
30 / 100
39 ms 8852 KB
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second

//#pragma GCC optimize ("O3")
//#pragma GCC target("tune=native")

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;

const int nax = 200 * 1000 + 10;
const int mod = 1e9 + 7;
int n;

struct pt {
	long long x, y;
};

int dx[6] = {0, 1, 1, 0, -1, -1};
int dy[6] = {2, 1, -1, -2, -1, 1};

int draw_territory(int N, int A, int B, vi dir, vi l) {
	n = N;
	ll onside = 0;
	vector<pt>pts = {{0, 0}};
	long long x = 0, y = 0;
	for(int i = 0; i < n; ++i) {
		onside += l[i];
		x += (ll)dx[dir[i]-1] * l[i];
		y += (ll)dy[dir[i]-1] * l[i];
		pts.PB({x, y});
	}
	long long p = 0;
	for(int i = 1; i < (int)pts.size(); ++i) {
		p += pts[i - 1].x * pts[i].y - pts[i - 1].y * pts[i].x;
	}
	if(p < 0) p = -p;
	ll cnt = p / 2;
	cnt += 2;
	ll inside = (cnt - onside) / 2;
	ll total = inside + onside;
	total %= mod;
	ll ans = (ll)A * total % mod;
	if(ans < 0) ans += mod;
	return ans;
}


//int main() {
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//cout << draw_territory(17, 2, 3, {1, 2, 3, 4, 5, 4, 3, 2, 1, 6, 2, 3, 4, 5, 6, 6, 1}, {1, 2, 2, 1, 1, 1, 1, 2, 3, 2, 3, 1, 6, 3, 3, 2, 1});
	//draw_territory(3, 1, 0, {1,3,5}, {1,1,1});
//}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 -
# 결과 실행 시간 메모리 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 724 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 2 ms 756 KB Output is correct
7 Correct 6 ms 1360 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 9 ms 2220 KB Output is correct
12 Correct 10 ms 2124 KB Output is correct
13 Correct 9 ms 2124 KB Output is correct
14 Correct 9 ms 2240 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 724 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 724 KB Output is correct
9 Correct 6 ms 1360 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 9 ms 2124 KB Output is correct
14 Correct 9 ms 2252 KB Output is correct
15 Correct 9 ms 2124 KB Output is correct
16 Correct 10 ms 2244 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 14 ms 3740 KB Output is correct
21 Correct 2 ms 724 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 18 ms 4168 KB Output is correct
24 Correct 33 ms 7228 KB Output is correct
25 Correct 34 ms 7348 KB Output is correct
26 Correct 21 ms 3784 KB Output is correct
27 Correct 10 ms 2380 KB Output is correct
28 Correct 8 ms 2124 KB Output is correct
29 Correct 32 ms 7616 KB Output is correct
30 Correct 34 ms 7600 KB Output is correct
31 Correct 39 ms 8852 KB Output is correct
32 Correct 39 ms 8636 KB Output is correct
33 Correct 19 ms 4340 KB Output is correct
34 Correct 10 ms 2464 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 296 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 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 0 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 -