We will hold AtCoder Regular Contest 148.

- Contest URL: https://atcoder.jp/contests/arc148
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20220911T2100&p1=248
- Duration: 120 minutes
- Number of Tasks: 6
- Writer: Nyaan
- Tester: maspy, satashun
- Rated range: — 2799

The point values will be 300-500-500-700-800-1000.

We are looking forward to your participation!

It seems that C is easier than last one. I'll try to solve more problems. rating++

I was able to solve A,B in contest not able to solve C. I saw the editorial but didnt got it properly,like this one "These can be shown by naive arguments, but they can also be smartly explained by linear algebra on mod 2."

Can you please explain your approach.

Thanks for helping in advance

My code:https://atcoder.jp/contests/arc148/submissions/34787970

Hope cross 1000 and A~C!

Although I usually get AB or only A.

congrats!

Hope the contest is great!!!

In the front of the support!

rp++！

Easy ABC! I can get higher rating. Thx problem provider.

In fact,I think B is easier than A...

(Maybe I'm strange.

l agree,but I got stuck by some dots.I am a novice

I solved B, but not able to solve A.

I solved A,C but wasnt able to solve B

same, maybe I'm just not good at math XD

Atcoder modulo contest

agree

D is a good problem！

i didn't solve C,how weak am i!

agree with that. i can't cyan.

In A, why is my submission giving WA: https://atcoder.jp/contests/arc148/submissions/34801963

I am checking all the prime factors of a[1]-a[0] to be the possible candidates for M. And I have also handle all equal case

why dont you try to get gcd of all adjacent number instead. Since a[i] mod x = a[i+1] mod x then (a[i+1]-a[i]) mod x = 0

during contest: hmmmmm F should be either montgomery reduction or barrett reduction but idk how to implement either......

after reading the editorial: I KNEW IT

Like, D can be solved without bipartite graphs. Just record the frequency of all numbers and then do some case processing.

Guys, how to stop writing artificially complicated solutions? Almost every time I try to solve a problem, a lot of hard solutions come to my head. How to write simple solutions, how to come up with such ideas? I will be glad to all your advice!

P.S.: Look at my ARC148 problem A solution to understand my "skill" of complicating solutions: https://atcoder.jp/contests/arc148/submissions/34792833

Count your blessings. A pass is good

Where is E and F's editorial?

Could you check this solution to problem E or give a hack to it:

https://atcoder.jp/contests/arc148/submissions/34801743

Thanks very much!

Can problem B be solved in O(N) using idea of KMP or some other algo?

I tried to find the substring to reverse by searching the lex max postfix (of the substring starting at the first 'p') using suffix_array(). That would be O(n log n)

But for some reason that did not worked.

Are the tests for problem D a little bit weak?

https://atcoder.jp/contests/arc148/submissions/34790673 will fail on 2 16 0 1 2 3

Anyone please explain Problem C's approach.

Thanks in Advance

Mark all the vertexes from query. Then iterate over them. Add to ans amount of descendants of current vertexes because they should be picked if they are not marked. And 1 to ans if parent is not marked else substract 1.

Can anyone explain D? Can't understand from editorial.

This submission for C has a complexity of $$$O(N^2)$$$ yet passed. It can be hacked by :

InputOutput1

Thanks for participating, hope you enjoyed the problems!

After the contest, we found a more intuitive solution to the problem F from the participants' submissions. Briefly, we can compute ab / 1000000007 by using 996491781/998244353^2 as an approximation to 1/1000000007. For more details, see this editorial(In Japanese).

So I was right about both montgomery reduction and barrett reduction? Darn, I should have tried implementing it...