atcoder_official's blog

By atcoder_official, history, 7 months ago, In English

We will hold AtCoder Beginner Contest 456.

We are looking forward to your participation!

  • Vote: I like it
  • +23
  • Vote: I do not like it

»
7 months ago, hide # |
 
Vote: I like it -6 Vote: I do not like it

Hope I can Solve C & D

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope I get new high score

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I solved E last time. Hope I can solve E this time.

»
7 months ago, hide # |
 
Vote: I like it -10 Vote: I do not like it

Good luck.

Hope I can solve E & F!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I am at school now.I didn't have 5.01 holiday!TOO BED!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hope I get high score.

unsigned long long score = -1;

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Another Good Contest :)

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Happy May Day:) have a nice ti

»
7 months ago, hide # |
 
Vote: I like it -18 Vote: I do not like it

有中国的吗?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

will try to solve utpo F

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope I can solve E. qwq

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hope i can solve at least 3 problems

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

God bless me. Now I have solved A~E.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Oh no!TLE

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why E is sooooo hard

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    No~just a graph DFS. Although I didn't solve it because I'm a slowpoke coder and by the time I've looked, there's only 25 mins left :(

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Solved A to D. How to solve E and F ?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Anyone else misread substrings as subsequences in problem C? I solved problem D before I even opened it...

  • »
    »
    7 months ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it +3 Vote: I do not like it

    in C, not the substrings as subsequence but my brain ignored the "modulo 998244353." part I was stuck why my answer is producing 3 WA after submitting :( good thing I was able to notice it last minute

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

solved A and C but wasted my time on that modulo, Also how to solve B??? :(

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    its very simple, just loop over all possible outcomes of 3 dice and check if they are a permutation of 4 5 6, then divide by 216 ($$$216 = 6^3$$$)

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      I see, during the contest I thought that the answer is some math formula that I probably don't know... but now that you mentioned it yeah I could just loop over all the possible outcomes since its not that much, my brain not working again :(

      • »
        »
        »
        »
        7 months ago, hide # ^ |
        ← Rev. 2  
        Vote: I like it 0 Vote: I do not like it

        Here's my code, although I do recommend changing the cnt4[3], cnt5[3] and cnt6[3] into cnt[3][3]. I changed a/b to b/a purely because of an emergency. It ACed though.

        #include<bits/stdc++.h>
        using namespace std;
        int a[3][6];
        int cnt4[3],cnt5[3],cnt6[3];
        double div(double a,double b){
        	if(a==0)return 0;
        	return b/a;
        }
        int main(){
        	for(int i=0;i<3;i++){
        		for(int j=0;j<6;j++){
        			cin>>a[i][j];
        		}
        	}	
        	double prob=0.00000000;
        	for(int i=0;i<3;i++){
        		for(int j=0;j<6;j++){
        			if(a[i][j]==4)cnt4[i]++;
        			if(a[i][j]==5)cnt5[i]++;
        			if(a[i][j]==6)cnt6[i]++;
        		}
        	}
        	prob+=div(6.000,(double)cnt4[0])*
        	div(6.000,(double)cnt5[1])*div(6.000,(double)cnt6[2]); 
        	prob+=div(6.000,(double)cnt4[0])*
        	div(6.000,(double)cnt5[2])*div(6.000,(double)cnt6[1]);
        	prob+=div(6.000,(double)cnt4[1])*
        	div(6.000,(double)cnt5[0])*div(6.000,(double)cnt6[2]);
        	prob+=div(6.000,(double)cnt4[1])*
        	div(6.000,(double)cnt5[2])*div(6.000,(double)cnt6[0]);
        	prob+=div(6.000,(double)cnt4[2])*
        	div(6.000,(double)cnt5[0])*div(6.000,(double)cnt6[1]);
        	prob+=div(6.000,(double)cnt4[2])*
        	div(6.000,(double)cnt5[1])*div(6.000,(double)cnt6[0]);
        	cout<<setprecision(11);
        	cout<<prob<<endl;
        	return 0;
        }
        
        

        Remember to use double instead of float.

        Honestly, you should learn more techniques before competing in ABC. Don't wrong me, I'm not telling you off, I'm just advising.

        • »
          »
          »
          »
          »
          7 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          Why do you return zero for division by zero? That's a weird function.

        • »
          »
          »
          »
          »
          7 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          There are no prerequisite techniques to compete in the beginner contest. He's learning this idea by upsolving the problem.

          • »
            »
            »
            »
            »
            »
            7 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

            I used dp in C. DP IS a algorithm which needs technique.

            • »
              »
              »
              »
              »
              »
              »
              7 months ago, hide # ^ |
               
              Vote: I like it 0 Vote: I do not like it

              I'm not saying that no technique is needed to solve all the problems. But problems A and B usually don't require any previous knowledge.

              That's why it's called the beginner contest.

              • »
                »
                »
                »
                »
                »
                »
                »
                7 months ago, hide # ^ |
                 
                Vote: I like it 0 Vote: I do not like it

                Oh well. I'm an beginner after all. You can check my account here. You can see that I rarely solve C, but I'm trying.

            • »
              »
              »
              »
              »
              »
              »
              7 months ago, hide # ^ |
               
              Vote: I like it 0 Vote: I do not like it

              By the way, C doesn't require DP. D does require DP (I think).

        • »
          »
          »
          »
          »
          7 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          Python solution:

          cnt = [Counter(map(int, input().split())) for _ in range(3)]
          
          print(sum(prod(cnt[i][p[i]] / 6 for i in range(3)) for p in permutations([4, 5, 6])))
          
          • »
            »
            »
            »
            »
            »
            7 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

            Why can you write comments so fast?! I mean, why can you write comments a minute apart?!!! When I do, it says "You can only write a comment in ten minutes."

          • »
            »
            »
            »
            »
            »
            7 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

            It's a mistake when coding. I wrongly thought that I needed division like n/0.

            • »
              »
              »
              »
              »
              »
              »
              7 months ago, hide # ^ |
               
              Vote: I like it 0 Vote: I do not like it

              That would be quite a thing to need to divide by zero...

              Anyways, you want your program to blow up on coding mistakes, not fail silently.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

G has 100 solves. ig now all beginners are familiar with gf. this is getting ridiculous

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I try C in a hour and I failed!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

This is ok.ABCDE and Rk1427.How G?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

a large gap between E and F

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

F,G is very hard!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

How F,G?