diff --git a/S2OJ/1686/1686.cpp b/S2OJ/1686/1686.cpp new file mode 100644 index 00000000..e585321d --- /dev/null +++ b/S2OJ/1686/1686.cpp @@ -0,0 +1,45 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e5 + 5, + M = (1 << 8) + 5; +const int mod = 998244353; + +int n, a[N], f[N], sum[M][M]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1; i <= n; i++) { + cin >> a[i]; + } + + for (int i = 1; i <= n; i++) { + f[i] = 1; + + int s = a[i] >> 8, + t = a[i] & ((1 << 8) - 1); + + for (int c = t;; c = (c - 1) & t) { + f[i] = (f[i] + sum[s][c]) % mod; + if (!c) break; + } + + for (int c = s ^ ((1 << 8) - 1);; c = (c - 1) & (s ^ ((1 << 8) - 1))) { + sum[s | c][t] = (sum[s | c][t] + f[i]) % mod; + if (!c) break; + } + } + + for (int i = 1; i <= n; i++) { + cout << f[i] << endl; + } + + return 0; +} diff --git a/S2OJ/1686/data/count1.ans b/S2OJ/1686/data/count1.ans new file mode 100644 index 00000000..ca288242 --- /dev/null +++ b/S2OJ/1686/data/count1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b5abb54efcd6712fd7ba7619a4dc49e5c50bc8d455ec914294120c1978119a0 +size 8785 diff --git a/S2OJ/1686/data/count1.in b/S2OJ/1686/data/count1.in new file mode 100644 index 00000000..fa9985df --- /dev/null +++ b/S2OJ/1686/data/count1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbe3d13dfe91e1cf3da3812f4f7511975a2b605a5606cbb3bd1bb8821c9bef4a +size 19515 diff --git a/S2OJ/1686/data/count10.ans b/S2OJ/1686/data/count10.ans new file mode 100644 index 00000000..66f25cf6 --- /dev/null +++ b/S2OJ/1686/data/count10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:731fddbbcaab15befebad6baf1c5e2c9e469f428bb12aa34fc9831aa10dad08b +size 988506 diff --git a/S2OJ/1686/data/count10.in b/S2OJ/1686/data/count10.in new file mode 100644 index 00000000..60516188 --- /dev/null +++ b/S2OJ/1686/data/count10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1a9ae45a444487721f055e020356053c0e78c691065a32afa456d7c6baee5ed +size 503459 diff --git a/S2OJ/1686/data/count2.ans b/S2OJ/1686/data/count2.ans new file mode 100644 index 00000000..51b84f8e --- /dev/null +++ b/S2OJ/1686/data/count2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e93e84bf521759165e5802cbdcfa421c05f0aeaf9e20d6cb4176dabc87f5cf8f +size 5686 diff --git a/S2OJ/1686/data/count2.in b/S2OJ/1686/data/count2.in new file mode 100644 index 00000000..fb6cb36e --- /dev/null +++ b/S2OJ/1686/data/count2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ca540ccca36a818c26ddf9adef7ffa29906a61ea0ab07f9ba475557e7058867 +size 13708 diff --git a/S2OJ/1686/data/count3.ans b/S2OJ/1686/data/count3.ans new file mode 100644 index 00000000..ebb2d51c --- /dev/null +++ b/S2OJ/1686/data/count3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d8bd93baea9198b02b9fcdc27accae8596c065f9f1e7192852f2788f163d357 +size 960133 diff --git a/S2OJ/1686/data/count3.in b/S2OJ/1686/data/count3.in new file mode 100644 index 00000000..f3dee94d --- /dev/null +++ b/S2OJ/1686/data/count3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c035a0ea62d401ff6410b92c50976c3c867b5813a43cefec272d66588ac7ccc +size 391768 diff --git a/S2OJ/1686/data/count4.ans b/S2OJ/1686/data/count4.ans new file mode 100644 index 00000000..6d2b4db3 --- /dev/null +++ b/S2OJ/1686/data/count4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee39a77084ac592027f984c2fb63a5222571c6fd39ad631e7c78312c1d98ee55 +size 790834 diff --git a/S2OJ/1686/data/count4.in b/S2OJ/1686/data/count4.in new file mode 100644 index 00000000..64fd2097 --- /dev/null +++ b/S2OJ/1686/data/count4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1b3521f0d733986a2f1c76e4a9b0f646fae3e9f7614d2d540225588dab188fb +size 383640 diff --git a/S2OJ/1686/data/count5.ans b/S2OJ/1686/data/count5.ans new file mode 100644 index 00000000..a0267048 --- /dev/null +++ b/S2OJ/1686/data/count5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd84a3731ede094993cd484e7db349e88e3f1fdcc43a73270bc2d4b084d79f18 +size 790693 diff --git a/S2OJ/1686/data/count5.in b/S2OJ/1686/data/count5.in new file mode 100644 index 00000000..3a843c9f --- /dev/null +++ b/S2OJ/1686/data/count5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c51ee8be8d4e6c52a9478541d6c241580f49bae2a219c36b4c2bd5653c7db2d6 +size 384143 diff --git a/S2OJ/1686/data/count6.ans b/S2OJ/1686/data/count6.ans new file mode 100644 index 00000000..643e6ae9 --- /dev/null +++ b/S2OJ/1686/data/count6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80bd1d2624f695c5750e4c8f7c6b1fff2ec2ca28e36bb4c6b7ee02564a225d7f +size 790793 diff --git a/S2OJ/1686/data/count6.in b/S2OJ/1686/data/count6.in new file mode 100644 index 00000000..685fad8a --- /dev/null +++ b/S2OJ/1686/data/count6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4803d57fd77690dcd103480ac1f8d839cede4f65762ea2ce55797bf4d3470c0 +size 383923 diff --git a/S2OJ/1686/data/count7.ans b/S2OJ/1686/data/count7.ans new file mode 100644 index 00000000..c70bc7c2 --- /dev/null +++ b/S2OJ/1686/data/count7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c2addfa036064ffb027691425cdab3bb6fcc36cb0c2304d7c55065a5b84f03e +size 790666 diff --git a/S2OJ/1686/data/count7.in b/S2OJ/1686/data/count7.in new file mode 100644 index 00000000..a1c320a7 --- /dev/null +++ b/S2OJ/1686/data/count7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e91fc3567123b4c223208614b4e4482c556974fe4c2d7879d967d73eb673137 +size 383404 diff --git a/S2OJ/1686/data/count8.ans b/S2OJ/1686/data/count8.ans new file mode 100644 index 00000000..17e39a44 --- /dev/null +++ b/S2OJ/1686/data/count8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:757d679a38fb8b45c516b46678a250fd2d18eb179ba7e326f70ba78973345f69 +size 988618 diff --git a/S2OJ/1686/data/count8.in b/S2OJ/1686/data/count8.in new file mode 100644 index 00000000..7a38e83d --- /dev/null +++ b/S2OJ/1686/data/count8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e15989970937a76f4ed81ea2b8f88b0701e999db86e8e806765a68332232a1e9 +size 503799 diff --git a/S2OJ/1686/data/count9.ans b/S2OJ/1686/data/count9.ans new file mode 100644 index 00000000..57ff66e4 --- /dev/null +++ b/S2OJ/1686/data/count9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a1f6843f6c46e6bae8ff0e3eeb347746ebbf7b0384e532eb92e55b4680bf3d8 +size 988481 diff --git a/S2OJ/1686/data/count9.in b/S2OJ/1686/data/count9.in new file mode 100644 index 00000000..75e5caad --- /dev/null +++ b/S2OJ/1686/data/count9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41b2dc80a7353d3289d7a50ae34efe0e6e3f54cab6cbe8175fa4fb3325fd2513 +size 503796 diff --git a/S2OJ/1686/data/ex_count1.ans b/S2OJ/1686/data/ex_count1.ans new file mode 100644 index 00000000..ebf62dda --- /dev/null +++ b/S2OJ/1686/data/ex_count1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c72f6a530802b95a1ad7e45024d7f58ccd800ac41b11ef753c39c9e77a0133d2 +size 11 diff --git a/S2OJ/1686/data/ex_count1.in b/S2OJ/1686/data/ex_count1.in new file mode 100644 index 00000000..76c34b66 --- /dev/null +++ b/S2OJ/1686/data/ex_count1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2494e866fa495be73797e41a9f59e75fdc5d6d82c9b59e57a4175dd77f147942 +size 13 diff --git a/S2OJ/1686/data/problem.conf b/S2OJ/1686/data/problem.conf new file mode 100644 index 00000000..859c60a4 --- /dev/null +++ b/S2OJ/1686/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15b5bebb56ebd0887acd9d1215876e3bde1efb1df1f4f38ce6f51822c3381bd1 +size 179