版本比较
[dp] ARC160F Count Sorted Arrays
正文
增加 3 行删除 3 行
28 行未改动2930313233333435363718 行未改动565758596060616263644 行未改动6970717273737475767728 行未改动#define ADD(a, b) a = (a + b)#define chk(x) (!(x) || __builtin_ctz(x) == n - __builtin_popcount(x))#define id(x, p) (((x) >> p) & 1)#define ID(x, y) ((x) * n + (y))//x=0时ctz出错 //x=0时ctz出错const int N = 15;int n, m, x, y, a[1 << N], f[1 << N], ans;bool vis[1 << N];vector<int> buc[N * N];18 行未改动 upd(), ans = 1; while(m--){ scanf("%lld%lld", &x, &y); x = (x + ans) % n, y = (y + 2 * ans) % n; if(x > y) swap(x, y); if(x > y) swap(x, y); bool fl = false; for(auto i : buc[ID(x, y)]) if(id(a[i], x) && !id(a[i], y)){ a[i] ^= (1 << x) | (1 << y);4 行未改动 } } buc[ID(x, y)].clear(); if(fl) upd(); printf("%lld\n", ans); printf("%lld\n", ans); } return 0;}```