Блог пользователя atcoder_official

Автор atcoder_official, история, 17 месяцев назад, По-английски

We will hold AtCoder Beginner Contest 405.

We are looking forward to your participation!

  • Проголосовать: нравится
  • +49
  • Проголосовать: не нравится

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

I found it very hard to improve my AtCoder rating at the time I reached 2000.

I have to go to evening self-study session every Sunday night, which just the same time as ARCs are running :(

»
16 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится +3 Проголосовать: не нравится

I'm too bad at counting problems :(

How to solve $$$E$$$?

»
16 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится -39 Проголосовать: не нравится

Where is your mother, the problem author of G?

I use combination to calculate the answer, the total time complexity is $$$O(n^{1.5})$$$. But I got TLE as a result.

Why do you treat the constant factors so hard? Maybe you are in need of family members?

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

BFS got TLE in D, anyone help?

  • »
    »
    16 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    are you sure? mine

    • »
      »
      »
      16 месяцев назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится 0 Проголосовать: не нравится

      gosh, I BFS the whole matrix from every 'E' and did time-wasting things to ensure the
      shortest distance, I didn't even think about it

      • »
        »
        »
        »
        16 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        But that is necessary isn't it ? We need to find the nearest emergency exit, not any exit. The official solution also does plain bfs, but how do they ensure that we are always pointing towards the nearest exit ?

        • »
          »
          »
          »
          »
          16 месяцев назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится

          Since the bfs runs on an unweighted graph, the first time any bfs comes to a particular node is the shortest distance from some 'E' to that node.

          It's like, imagine a turtle exiting each 'E' node, labelled 'E1', 'E2' etc for each unique 'E'. Now, at each node, it divides into as many turtles as there are possible routes emerging from that cell (4 at max, if there are no walls and all surrounding cells are unvisited). They obviously maintain the same label 'Ei'. Now, since all the turtles left each 'E' at the same time, the FIRST turtle reaching a particular cell bearing some marker 'Ei' signifies the shortest distance.

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

someone please help me with E. I have never done something with placements type thingy.

  • »
    »
    16 месяцев назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    C(n + k — 1, k — 1) for putting n same balls into k different buckets(allow none),mine

    • »
      »
      »
      16 месяцев назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Can you explain a litttle bit more of your idea

      • »
        »
        »
        »
        16 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        This is my way of thinking:

        The first observation is that bananas (b) and grapes (g) will come to the right of all apples.

        Suppose that there are x oranges to the right of the last apple. Now, you first need to arrange a — 1 apples before the last apple. The no. of ways to do this is C(a + o — x — 1, a — 1). Now, to the right of the last apple, x + b + g positions remain. On fixing the positions of bananas, the positions of oranges and grapes will also get fixed. This would be C(x + b + g, b).

        Iterate over x = 0 to o and add C(a + o — x — 1, a — 1) * C(x + b + g, b) to the answer.

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Who wrote E ???

  • »
    »
    16 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    If there are $$$a$$$ apples, $$$o$$$ oranges, $$$g$$$ grapes, $$$b$$$ bananas:

    We let $$$n=a+o+g+b$$$.

    If we have determined the positions of apples and bananas, the positions of grapes and oranges are also determined.

    Besides, for every valid way to put the apples and bananas, we can also find a valid way to put grapes and oranges.

    Therefore, we can let $$$i \in [a,n-g-b] $$$, which means the last position in all the apples.

    So, for each $$$i$$$, the answer is $$$C_{i-1}^{a-1} \times C_{n-i}^{b}$$$, as we can put apples in $$$[1,i-1]$$$(the position $$$i$$$ must be placed with an apple), and put the bananas in $$$[i+1,n]$$$.

    My Submission

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Who can tell me why my program was wrong!!!

#include<bits/stdc++.h>
using namespace std;
long long a,o,b,g,inv[4000005],chu[4000005],f[4000005];
const long long p=998244353;
long long C(long long n,long long m){
	if(m==0)
		return 1;
	if(n<m)
		return 0;
    return f[n]%p*chu[n-m]%p*chu[m]%p;
}
int main(){
	cin>>a>>o>>b>>g;
	f[0]=1,inv[1]=1,chu[1]=1;
	for(int i=1;i<=4e6;i++)
        f[i]=f[i-1]*i%p;
    for(int i=2;i<=4e6;i++){
        long long k=p/i,r=p%i;
        inv[i]=((p-k)*inv[r])%p;
        chu[i]=(chu[i-1]%p*inv[i]%p);
    }
    long long ans=0;
    int n=a+o+g+b;
    //cout<<C(100000,1000)<<" ";
    for(long long i=a;i<=n-g-b;i++)
    	ans=(ans+C(i-1,a-1)*C(n-i,b)%p)%p;
	printf("%lld",ans);
	return 0;
}
»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why isn't the submit button working? I'm selecting a language and it is automatically removing the selection of the language and giving me error

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I solved F in an offline way with BIT. 1 pass from left to right to find segments [A, B] such that A < C < B < D. 1 pass from right to left to find segments [A, B] such that C < A < D < B.

What is the solution provided by the editorial? Seems like a pretty common technique. Anyone has deeper materials on that topic?

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

someone please help me with problem G. Why my program is wrong? I've tasted it in many test cases but I cannot see the mistake

https://atcoder.jp/contests/abc405/submissions/65704475

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I have a problem on G.

There is 10 wrong answer in my submission.

HELP

my submission

  • »
    »
    16 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Because sometimes your nums frequency can be negative, and then what is his inversed elements?

    you should revise your implementation of the MO algorithm so that there are no negative frequencies

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I learned Mo’s algorithm + square-root decomposition in G :)

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Was it the new record by number of participants? ~685x20

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My original account disappered after this competition without notice.If there is anyone know that's why?

»
16 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can anyone tell is my approach wrong or my implementation is not correct for problem F

for finding the number of intersected line i m subtracting sum of line segments that completely lie on either side of the arc (made by the queried line segment) from the total number of line segments using Merge Sort Tree

Submission