#include<bits/stdc++.h>usingnamespacestd;constintMAXN = 3e5 +10;constintMAXP = 1e6 +10; typedeflonglongll; typedeflongdoubleld;intn , m;intval[MAXN] , p[MAXP]; template<typename T> inlinevoidchkmax(T &x,T y) { x =max(x,y); } template<typename T> inlinevoidchkmin(T &x...
Codeforces 920 F SUM and REPLACE Dicription Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6). You are given an array a of n integers. You ...
Codeforces 920F - SUM and REPLACE 【线段树】 题目链接> 题目大意: 给你一个序列,有两个操作,一个是求区间 l - r 的和,另一个是对区间l-r的元素修改值,x=d(x),d(x)为x的因子个数。 解题分析: 因为可能有多次修改操作,并且修改的范围可能比较大,所以提前将1~1e6范围内的数的因子个数全部打表进行...
Codeforces 920 F SUM and REPLACE Dicription LetD(x) be the number of positive divisors of a positive integerx. For example,D(2) = 2 (2 is divisible by 1 and 2),D(6) = 4 (6 is divisible by 1, 2, 3 and 6). You are given an arrayaofnintegers. You have to proces...
CodeForces Algorithms. Contribute to DionysiosB/CodeForces development by creating an account on GitHub.
In other words, no more than k times you are allowed to take an arbitrary number ai from the array and replace it with - ai. Each number of the array is allowed to choose an arbitrary number of times. Your task is to calculate the maximum possible optimal sum of the array ...
1ix1~i~x1ix(1≤i≤n1 \le i \le n1≤i≤n,1≤x<1091 \le x < 10^91≤x<109) — replaceaia_iaiwith the valuexxx; 2lr2~l~r2lr(1≤l≤r≤n1 \le l \le r \le n1≤l≤r≤n) — find theunbalancedsubset of the multiset of the numbersal,al+1,…,ara_l, a_{l + 1}...
1807C-FindAndReplace.cpp 1807D-OddQueries.cpp 1807G1-SubsequenceAdditionEasyVersion.cpp 1807G2-SubsequenceAdditionHardVersion.cpp 1808A-LuckyNumbers.cpp 1809A-Garland.cpp 1809B-PointsOnPlane.cpp 1810A-BeautifulSequence.cpp 1810B-Candies.cpp 1811A-InsertDigit.cpp 1811B-ConveyorBelts.cpp 1811C-Resto...
Given N and K we need to calculate F(N, K) (mod 2^32) INPUT: 1 <= N, K < 2^32 PS: I think about this question for a few days and didn't get success if you have any idea how to solve it, please share it :D The problem can be found here to submit (statement in portu...
CodeForces - 805D Minimum number of steps(思路题) 上题: We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings "ab" in the string and replace it with the string "bba&qu......