版本比较
题解:CF1732E Location
正文
增加 4 行删除 4 行
41 行未改动42434445464746474849505163 行未改动11511611711811911912012112212320 行未改动14414514614714814814915015115251 行未改动41 行未改动 #define ion bw(20) char i[ion], o[ion], *icl = i, *icr = i, *oc = o; char gc() { return (icl == icr && (icr = (icl = i) + fread(i, 1, ion, stdin), icl == icr)) ? EOF : *icl++; } void pc(char c) { if (oc - o == ion) fwrite(o, 1, ion, stdout), oc = o; *oc++ = c; } void rd(auto &x) { char c; int f = 1; x = 0; while (c = gc(), c < '0' || c > '9') if (c == '-') f = -1; while ('0' <= c && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = gc(); x *= f; } void pr(auto x) { int a[64], p = 0; if (x < 0) x = -x, pc('-'); do a[p++] = x % 10; while (x /= 10); while (p--) pc(a[p] + '0'); } void rd(auto &x) { char c; int f = 1; x = 0; while (c = gc(), c < '0' || c > '9') if (c == '-') f = -1; while ('0' <= c && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = gc(); x *= f; } void pr(auto x) { int a[64], p = 0; if (x < 0) x = -x, pc('-'); do a[p++] = x % 10; while (x /= 10); while (p--) pc(a[p] + '0'); } IO& operator>>(char &c) { return c = gc(), *this; } IO& operator<<(char c) { return pc(c), *this; } IO& operator<<(const char *c) { while (*c) pc(*c++); return *this; } IO& operator>>(auto &x) { return rd(x), *this; }63 行未改动 tg[i] = x; g[i] = inf; } F(d, dx) { // 暴力 int x_d = x / d; L(i, lb + 1, rb - 1) if (M[d][i] != inf_32) L(i, lb + 1, rb - 1) if (M[d][i] != inf_32) cmin(g[i], x_d * M[d][i]); } down(rb); L(i, l[rb], qr) a[i] = x;20 行未改动 cmin(ans, a[i] / d * b[i] / d); } return ans; } void init() { void init() { L(i, 1, N - 5) for (int j = i; j <= N - 5; j += i) divs[j].eb(i); vis[0] = vis[1] = true; fac[1][0] = fac[1][1] = fac[1][2] = 1; L(i, 2, N - 5) { // 质数筛51 行未改动