0_0_20613070_27633.cpp:6:6: error: 'len' does not name a type
len) { ++left; } if (v == -1) { return; } while (left < right) { int p = right - 1; if (w[p] + abs(id[p] - pos) > v) { break; } --right; } id[right] = pos, w[right] = v; ++right; } int left_id() { return id[left]; }} que; void DP(int k, int len, int d) { switch (d) { case 1: for (int j = 0; j < m; ++j) { que.init(); for (int i = n - 1; i >= 0; --i) { que.insert(i, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][que.left_id()][j] + que.left_id() - i; } } } break; case 3: for (int j = 0; j < m; ++j) { que.init(); for (int i = 0; i < n; ++i) { que.insert(i, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][que.left_id()][j] + i - que.left_id(); } } } break; case 2: for (int i = 0; i < n; ++i) { que.init(); for (int j = m - 1; j >= 0; --j) { que.insert(j, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][i][que.left_id()] + que.left_id() - j; } } } break; case 4: for (int i = 0; i < n; ++i) { que.init(); for (int j = 0; j < m; ++j) { que.insert(j, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][i][que.left_id()] + j - que.left_id(); } } } break; }} int main(int argc, char** argv) { int x, y, tot, T; scanf("%d", &T); while (T--) { scanf("%d%d%d%d%d", &n, &m, &x, &y, &tot); init(x, y); for (int i = 1; i <= tot; ++i) { int len, d; scanf("%d%d", &len, &d); DP(i % 2, len, d); } int ans = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { ans = (ans < f[tot % 2][i][j] ? f[tot % 2][i][j] : ans); } } printf("%d\n", ans); } return 0;}
^
0_0_20613070_27633.cpp:6:48: error: expected unqualified-id before 'if'
len) { ++left; } if (v == -1) { return; } while (left < right) { int p = right - 1; if (w[p] + abs(id[p] - pos) > v) { break; } --right; } id[right] = pos, w[right] = v; ++right; } int left_id() { return id[left]; }} que; void DP(int k, int len, int d) { switch (d) { case 1: for (int j = 0; j < m; ++j) { que.init(); for (int i = n - 1; i >= 0; --i) { que.insert(i, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][que.left_id()][j] + que.left_id() - i; } } } break; case 3: for (int j = 0; j < m; ++j) { que.init(); for (int i = 0; i < n; ++i) { que.insert(i, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][que.left_id()][j] + i - que.left_id(); } } } break; case 2: for (int i = 0; i < n; ++i) { que.init(); for (int j = m - 1; j >= 0; --j) { que.insert(j, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][i][que.left_id()] + que.left_id() - j; } } } break; case 4: for (int i = 0; i < n; ++i) { que.init(); for (int j = 0; j < m; ++j) { que.insert(j, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][i][que.left_id()] + j - que.left_id(); } } } break; }} int main(int argc, char** argv) { int x, y, tot, T; scanf("%d", &T); while (T--) { scanf("%d%d%d%d%d", &n, &m, &x, &y, &tot); init(x, y); for (int i = 1; i <= tot; ++i) { int len, d; scanf("%d%d", &len, &d); DP(i % 2, len, d); } int ans = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { ans = (ans < f[tot % 2][i][j] ? f[tot % 2][i][j] : ans); } } printf("%d\n", ans); } return 0;}
^
0_0_20613070_27633.cpp:6:98: error: expected unqualified-id before 'while'
len) { ++left; } if (v == -1) { return; } while (left < right) { int p = right - 1; if (w[p] + abs(id[p] - pos) > v) { break; } --right; } id[right] = pos, w[right] = v; ++right; } int left_id() { return id[left]; }} que; void DP(int k, int len, int d) { switch (d) { case 1: for (int j = 0; j < m; ++j) { que.init(); for (int i = n - 1; i >= 0; --i) { que.insert(i, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][que.left_id()][j] + que.left_id() - i; } } } break; case 3: for (int j = 0; j < m; ++j) { que.init(); for (int i = 0; i < n; ++i) { que.insert(i, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][que.left_id()][j] + i - que.left_id(); } } } break; case 2: for (int i = 0; i < n; ++i) { que.init(); for (int j = m - 1; j >= 0; --j) { que.insert(j, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][i][que.left_id()] + que.left_id() - j; } } } break; case 4: for (int i = 0; i < n; ++i) { que.init(); for (int j = 0; j < m; ++j) { que.insert(j, f[1 - k][i][j], len); if (Map[i][j] == 'x') { que.init(); } if (que.empty()) { f[k][i][j] = -1; } else { f[k][i][j] = f[1 - k][i][que.left_id()] + j - que.left_id(); } } } break; }} int main(int argc, char** argv) { int x, y, tot, T; scanf("%d", &T); while (T--) { scanf("%d%d%d%d%d", &n, &m, &x, &y, &tot); init(x, y); for (int i = 1; i <= tot; ++i) { int len, d; scanf("%d%d", &len, &d); DP(i % 2, len, d); } int ans = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { ans = (ans < f[tot % 2][i][j] ? f[tot % 2][i][j] : ans); } } printf("%d\n", ans); } return 0;}
^
|