正文
增加 10 行删除 10 行
38 行未改动394041424344454647484950515253548 行未改动63646566676869707118 行未改动909192939495969798991001011021032 行未改动1061071081091101111121131141151161171181192 行未改动12212312412512612712812913017 行未改动38 行未改动int stac[T], top, val[T], col[T], stamp, dfn[T], low[T], cnt;bool instac[T];struct Node {int x, y, t;bool operator <(const Node &ano) const {return x < ano.x || x == ano.x && y < ano.y;}} a[N];inline void add(int u, int v) {edu[++edc] = u; edv[edc] = v;vet[++ecnt] = v; nxt[ecnt] = head[u];head[u] = ecnt;}8 行未改动for (int e = head[u]; e; e = nxt[e]) {int v = vet[e];if (!dfn[v]) {tarjan(v); low[u] = min(low[u], low[v]);} else if (instac[v])low[u] = min(low[u], dfn[v]);}if (dfn[u] == low[u]) {col[u] = ++cnt; val[cnt] = u > r + c;18 行未改动}int main() {scanf("%d%d%d", &n, &r, &c);for (int i = 1; i <= n; ++i)scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].t);sort(a + 1, a + 1 + n);for (int i = 1; i <= n; ++i) {//处理额外点对当前点的连边add(a[i].x, r + c + i);add(r + a[i].y, r + c + i);//处理当前点对其它点的连边if (a[i].t == 1) add(r + c + i, a[i].x);else if (a[i].t == 2) add(r + c + i, r + a[i].y);2 行未改动int x = a[i].x + dx[k], y = a[i].y + dy[k];if (x >= 1 && x <= r && y >= 1 && y <= c) {int id = getid(x, y);if (id != -1) add(r + c + i, r + c + id);}}}}//缩点t = r + c + n;for (int i = 1; i <= t; ++i)if (!dfn[i]) tarjan(i);ecnt = 0; memset(head, 0, sizeof(head));for (int i = 1; i <= edc; ++i)2 行未改动++in[col[edv[i]]];}//拓扑排序qhead = 0; qtail = -1;for (int i = 1; i <= cnt; ++i)if (!in[i]) {que[++qtail] = i;f[i] = val[i];}17 行未改动38 行未改动394041424344454647484950515253548 行未改动63646566676869707118 行未改动909192939495969798991001011021032 行未改动1061071081091101111121131141151161171181192 行未改动12212312412512612712812913017 行未改动38 行未改动int stac[T], top, val[T], col[T], stamp, dfn[T], low[T], cnt;bool instac[T];struct Node {int x, y, t;bool operator <(const Node &ano) const {return x < ano.x || x == ano.x && y < ano.y;}} a[N];inline void add(int u, int v) {edu[++edc] = u; edv[edc] = v;vet[++ecnt] = v; nxt[ecnt] = head[u];head[u] = ecnt;}8 行未改动for (int e = head[u]; e; e = nxt[e]) {int v = vet[e];if (!dfn[v]) {tarjan(v); low[u] = min(low[u], low[v]);} else if (instac[v])low[u] = min(low[u], dfn[v]);}if (dfn[u] == low[u]) {col[u] = ++cnt; val[cnt] = u > r + c;18 行未改动}int main() {scanf("%d%d%d", &n, &r, &c);for (int i = 1; i <= n; ++i)scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].t);sort(a + 1, a + 1 + n);for (int i = 1; i <= n; ++i) {//处理额外点对当前点的连边add(a[i].x, r + c + i);add(r + a[i].y, r + c + i);//处理当前点对其它点的连边if (a[i].t == 1) add(r + c + i, a[i].x);else if (a[i].t == 2) add(r + c + i, r + a[i].y);2 行未改动int x = a[i].x + dx[k], y = a[i].y + dy[k];if (x >= 1 && x <= r && y >= 1 && y <= c) {int id = getid(x, y);if (id != -1) add(r + c + i, r + c + id);}}}}//缩点t = r + c + n;for (int i = 1; i <= t; ++i)if (!dfn[i]) tarjan(i);ecnt = 0; memset(head, 0, sizeof(head));for (int i = 1; i <= edc; ++i)2 行未改动++in[col[edv[i]]];}//拓扑排序qhead = 0; qtail = -1;for (int i = 1; i <= cnt; ++i)if (!in[i]) {que[++qtail] = i;f[i] = val[i];}17 行未改动