BZOJ 3434 Wc2014 time-space shuttle Mobius Inversion, bzoj3434

Source: Internet
Author: User

BZOJ 3434 Wc2014 time-space shuttle Mobius Inversion, bzoj3434

For a given n-dimensional space, we need to select c collocated points in the n-dimensional space, which requires that the coordinates of these points increase monotonically for each dimension, the I-dimension coordinate is an integer in [1, mi]

In order to express convenience | the number of solutions that represent the intermediate thing. By the way, the I-dimensional coordinates are set to ai, but this is not concise. Therefore, x is used to represent the 1st-dimensional coordinates, and y is used to represent the second-dimensional coordinates, θ indicates the n-dimensional coordinate




Seems like my method is SB? No matter whether it's good to push it out --

Nima BZOJ slag evaluation machine card constant--clearly said that UOJ5s has passed --

# Include <cstdio> # include <cstring> # include <iostream> # include <algorithm> # define M 100100 # define MOD 10007 using namespace std; int mu [M], prime [M], tot; bool not_prime [M]; int f [M] [20], mu_f [M] [20], sum [M] [20] [12]; // f [I] [j] indicates the sum of I, number of positive integers with a length of j // mu_f [T] [j] indicates the value of Σ [I | T] mu [I] F [T/I] When C-1 = j // sum [T] [j] [k] indicates C-1 fix and int n, c, min_m, m [12], a [12]; void Linear_Shaker () {int I, j; mu [1] = 1; for (I = 2; I <= 10000 0; I ++) {if (! Not_prime [I]) {prime [++ tot] = I; mu [I] =-1 ;}for (j = 1; prime [j] * I <= 100000; j ++) {not_prime [prime [j] * I] = 1; if (I % prime [j] = 0) {mu [prime [j] * I] = 0; break;} mu [prime [j] * I] =-mu [I] ;}} void Pretreatment () {int I, j, k; Linear_Shaker (); for (I = 1; I <= 100000; I ++) {f [I] [1] = 1; for (j = 2; j <= I & j <= 19; j ++) f [I] [j] = (f [I-1] [j] + f [I-1] [J-1]) % MOD;} for (I = 1; I <= 100000; I ++) for (j = 1; j <= 19; j ++) for (k = 100000/I; k --) (mu_f [k * I] [j] + = mu [I] * f [k] [j]) % = MOD; for (I = 1; I <= 100000; I ++) for (j = 1; j <= 19; j ++) {int temp = 1; for (k = 0; k <= 11; k ++, temp * = I, temp % = MOD) (sum [I] [j] [k] = sum [I-1] [j] [k] + mu_f [I] [j] * temp % MOD) % = MOD ;}} void Get_A (int lower) {int I, j; memset (a, 0, sizeof a); a [0] = 1; for (I = 1; I <= n; I ++) {int d = m [I]/lower; int k =-(long) d * (d + 1)> 1) % MOD; int B = (long) m [I] * d) % MOD; for (j = n; j; j --) (a [j] = k * a [J-1] + B * a [j]) % = MOD; (a [0] * = B) % = MOD ;}} int main () {int T, I, j, last; Pretreatment (); for (cin> T; T --) {scanf ("% d", & n, & c); min_m = 0x3f3f3f; for (I = 1; I <= n; I ++) {scanf ("% d", & m [I]); min_m = min (min_m, m [I]);} int ans = 0; for (I = 1; I <= min_m; I = last + 1) {last = 0x3f3f3f3f; for (j = 1; j <= n; j ++) last = min (last, m [j]/(m [j]/I); Get_A (I); for (j = 0; j <= n; j ++) (ans + = a [j] * (sum [last] [C-1] [j]-sum [I-1] [C-1] [j]) % MOD) % = MOD ;} printf ("% d \ n", (ans + MOD) % MOD);} return 0 ;}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.