commit b5630752a30931dd7f66ab681d2c6e1545725c72
parent 59b9d700be54fec31137bd06f918b0cda1ec2f31
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 28 Mar 2015 11:44:25 +0100
input
Diffstat:
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/contest/a3nm/main.cpp b/contest/a3nm/main.cpp
@@ -8,14 +8,22 @@ using namespace std;
#define MAXN 302
#define NTARGET 2252
+#define NALT 10
int R, C, A;
int L, V, B, T;
int rs, cs;
+struct Pt{
+ int r, c;
+ Pt(int r=0, int c=0) : r(r), c(c) {}
+};
+
vector<int> coverage[MAXN][MAXN];
-int targetx[NTARGET], targety[NTARGET];
+Pt dest[NALT][MAXN][MAXN]; // where does the wind take us: -1 -1 = out
+
+Pt target[NTARGET];
char map
@@ -27,11 +35,18 @@ vector<int> r2;
vector<int> c2;
vector<int> ham;
+int columndist(int c1, int c2) {
+ return min(abs(c1 - c2), C - abs(c1 - c2));
+}
+
int covered(int t, int r, int c) {
// does a loon at r c cover t?
+ int u = target[t].r, v = target[t].c;
+ return ((r - u) * (r - u) + columndist(c, v) * columndist(c, v) <= V*V);
+}
-void coverage() {
+void calccoverage() {
// compute for each square which targets are covered
for (int r = 0; r < R; r++)
for (int c = 0; c < C; c++)
@@ -45,11 +60,23 @@ int main(int argc, char **argv) {
scanf("%d%d%d", &L, &V, &B, &T);
scanf("%d%d", &rs, &cs);
for (int i = 0; i < L; i++) {
- scanf("%d%d", &(targetx[i]), &(targety[i]));
+ int r, c;
+ scanf("%d%d", &r, &c);
+ target[i] = Pt(r, c);
}
- coverage();
-
-
+ for (int a = 0; a < A; a++)
+ for (int r = 0; r < R; r++)
+ for (int c = 0; c < C; c++) {
+ int dr, dc;
+ scanf("%d%d", &dr, &dc);
+ int destr, destc;
+ destr = r + dr;
+ destc = (c + dc + C) % C;
+ if (destr < 0 || destr >= R)
+ destr = destc = -1; // out
+ dest[a][r][c] = Pt(destr, destc);
+ }
+ calccoverage();
return 0;
}