0w1

Entries from 2017-12-26 to 1 day

Yuki 612 Move on grid

Problem Description: Initially you are at coordinate (0, 0, 0). At each second, you have equal probability to move yourself with vector (-a, 0, 0), (a, 0, 0), (0, -b, 0), (0, b, 0), (0, 0, -c), (0, 0, c). Given t, a, b, c, d, e, and let p …

Yuki 615 集合に分けよう

Problem Description: There is a set of N numbers. You would like to split the set into K non-empty subsets, so that the sum of contribution of each subset is minimal. Contribution of a subset can be computed as the absolute difference betw…

Yuki 616 へんなソート

Problem Description: You are given an array A with length N. You have a weird "sorting" algorithm, the output is non-deterministic, but we know that it must be some arrangement of the input array, and contains no more than K inversions. Fi…

Yuki 623 fudan no modulus to tigau

Problem Description: Given Q queries of X's, compute f(X), modulo 998244353.Constraints: 2≤n≤50 1≤q≤50 0≤ai,bi≤i - 1 0≤xi≤998244352Solution: Compute each query independently, the only variant is n (relevantly small), so we can apply DP.Cod…

Yuki 626 Randomized 01 Knapsack

Problem Description: 0/1 Knapsack problem. Test cases are generated at complete randomness.Constraints: 2 ≤ N ≤ 5000 v[i], w[i] is uniformly distributed in range [1, 1e12] 1 ≤ W ≤ 1e12 * NSolution: Branch and Bound. Referenced kimiyuki's b…

SOJ 86. 一維陣列區間加值區間乘值區間查詢總和

Problem Description: Initially, you are given an array of length N. Q operations follow: OP 1: Add C to every element in X..Y OP 2: Multiply by W on every element in X..Y OP 3: Output the sum of elements in X..Y, modulo 1e9 + 7Constraints:…