We will hold AtCoder Beginner Contest 136.

- Contest URL: https://atcoder.jp/contests/abc136
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20190804T2100&p1=248
- Duration: 100 minutes
- Number of Tasks: 6
- Writer: DEGwer, drafear, evima, satashun
- Rated range: ~ 1999

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

How to solve E? ._.

Notice that any number X which divides all the elements of the array also divides the sum of the array. Moreover, the sum is constant after any number of operations.

Therefore, we iterate over all the divisors of the original array, and find the highest divisor which can be the answer.

For checking if X is valid, I found A[i] % X for all A[i], pushed them into an array, sorted them, and then tried to reduce the left ones and increase the ones on the right to minimise the number of operations required.

Code: https://atcoder.jp/contests/abc136/submissions/6699490

new to this site but have anyone tried binary search? i mean given a dividend we can use greedy method to judge whether it's possible and Nlog(K+max(array)) isn't too bad. although noticing the invariant is elegant, it's like kasiski's method.

Can someone explain E and F??

They are explained in detail on my blog, but the gist is that for E, we should check whether each factor of the sum of the values in the array is achievable. We can use a greedy strategy to compute the minimum number of moves necessary to make all of our numbers divisible by one of these factors. For F, we use the Principle of Inclusion/Exclusion, along with a segment tree to track some important values. (Full details are on the blog.)

My solutions are up at https://codeforces.com/blog/entry/68900, for anyone interested.

Thanks for the editorial @geothermal

Thanks for quick and well-explained editorial after each Atcoder contest!

Can you help me understand how idea of parity worked in problem D's solution?

Whenever a child moves, the parity of its position changes, as any odd position is adjacent to two even positions, while any even position is adjacent to two odd positions. Hence, after $$$10^{100}$$$ moves, the parity of its resulting position will be the same as the parity of its original position, since the parity will have switched an even number of times. Once we've found two adjacent positions each child could end up in, therefore, we can pick the one with the same parity as the child's original position.

It will have same parity because 10^100 is even ?

hey! Geothermal please give approach for B-uneven numbers that you mentioned in your editorial for complexity O(log(n)).

How to Solve D ???

You can maintain the prefix and suffix sums of

`L`

and`R`

in each grid, while resetting them to $$$0$$$ when the letter in the grid is not the same as the one you want to maintain.This seems a little bit hard to understand, so code is here:

where the $$$prel,prer,sufl,sufr$$$ arrays denote the prefix and suffix sums.

Then, you can see that if a child wanders to

`RL`

, he would always be wandering between these two grids. So a child would go one direction (as the one written in his grid) until he arrives to`RL`

, since $$$10^{100}$$$ is a huge even number, you can assume that the movements fall into a 2-loop, count the prefix and suffix sums and you will know the answer.To understand the parity, you can write down the direction a child takes, and you'll find it's either

`RRRRRRR...RRRLRLRLRLRLRLRLRLRLRLRLRLRL...`

or`LLLLLL....LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...`

, and you can find that it repeats after some time.Well find the closest opposing character in proper direction (for R, the closest L to right // for L, the closest R to left).

It is easy to see that the child will step there "once".

It is also easy to see that the child will "rotate" there + on its neighbor (before it) ..co in some "RL" substring :)

To see where it will end, simply check the parity of distance.

Good Luck & Wish you a nice day!

Isn't it RL substring?

You are right — thanx :)

Repaired :))

E and F were written by me. Thank you for participating!

Can anyone help me find out what is the problem of my code of F?Thx https://atcoder.jp/contests/abc136/submissions/6720126,it wrong 2 of the testdatas.

How to Solve F ??? help me thanks

What is the difficulty level/rating of ABC's problems E & F as compared to codeforces's problems ?

Can anyone give a solution for question D??

https://atcoder.jp/contests/abc136/submissions/6698199

Hey, I tried to solve C, but get a wrong answer. Can someone help me to find why my way is wrong?

I just check whether there is difference more than 1 or there is continuous difference of 1 just like 9 8 7 ,so ,what's wrong?I can not solve it. Please.\ That's my code.

`int a[100000+50]; int main() { int T=1; while(T--){ int n=read(); rep(i,1,n) a[i]=read(); int flag=1; //int num=0; rep(i,1,n-1) { if(a[i]-a[i+1]>1) {flag=0;break;} if(a[i]-a[i+1]==1) { if(i<n-1) { if(a[i+1]-a[i+2]==1) {flag=0;break;} } } } if(flag) puts("Yes"); else puts("No"); } }`

Check if you pass:

As far as I can tell your code misses the differences offset by equal values.

wow!awesome!Thank you!

My solution for F using inclusion/exclusion and AVL tree for order statistic Code : https://atcoder.jp/contests/abc136/submissions/6742192

Can someone please check my code for $$$E$$$ and point out the mistake. It's failing 10 out of 84 test cases : Solution

3 0

34 34 34

Why does not my code work for problem C? Any ideas?

// // main.cpp // atCoder Beginner Contest 136 // // Created by Osmel Lavalier Martin on 2020-10-13. //

## include <bits/stdc++.h>

using namespace::std;

## define deb(x) cout << #x << " " << x << endl

template<typename... T> void write(T&&... args) { ((cout << args << " "), ...); }

template<typename... T> void read(T&... args) { ((cin << args), ...); }

int main() {

int n; cin >> n; vector arr(n);

return 0; }