3

AtCoder Regular Contest 145 Announcement

 1 year ago
source link: http://codeforces.com/blog/entry/105371
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

We will hold AtCoder Regular Contest 145.

The point values will be 400-500-600-700-800-1200.

We are looking forward to your participation!

5 weeks ago, # |

Looking forward to ARC !!

  • 5 weeks ago, # ^ |

    me too

5 weeks ago, # |

As the writer, good luck and enjoy yourself! :D

  • 5 weeks ago, # ^ |

    As a contestant, I want to be blue :)

  • 5 weeks ago, # ^ |

    Can I do up-hack to my AC submission? This submission can be hacked by n=4 AAAA

5 weeks ago, # |

What's the approximate rating of ARC's problems B & C according to CodeForces rating distribution?

5 weeks ago, # |

math and counting round

5 weeks ago, # |

I really suck at counting, but today I couldn't figure out what the 16 different permutations were in C, the most I found was 12 :P

Can anyone list those out please?

  • 5 weeks ago, # ^ |

    Code that prints

5 weeks ago, # |

Could someone point out what case am I missing in my submission for B?

Submission : https://atcoder.jp/contests/arc145/submissions/33632229

  • 5 weeks ago, # ^ |

    I believe you miss the cases where .

    • 5 weeks ago, # ^ |

      Thanks for pointing that out.

5 weeks ago, # |

My first AtCoder contest. The problems were good, it was interesting for me. Thanks !

5 weeks ago, # |

As a contestant, I was not a big fan of A,B,D. Those problems' ideas are not hard to get, but have very annoying corner cases...

5 weeks ago, # |

Problem D is magic, but I want to know, why the set , which the differential sequence is is not the optimal one.

  • 5 weeks ago, # ^ |

    The set has an value on the -th element, while the optimal set has value on the -th one ,which is enough to meet the constraint of .

    • 5 weeks ago, # ^ |

      U R right.I tried that,and the number can be as large as 4e7

  • 5 weeks ago, # ^ |

    That doesn't even work,

5 weeks ago, # |

Sequence of pC can be found here.

5 weeks ago, # |

My friend told me the problem C is in the OEIS, what do you think of it?

5 weeks ago, # |

void jaiishriRam(){ ll n; cin>>n; string s; cin>>s; if(n==2) { if(s=="BA" || s=="AB") { cout<<"NO"<<endl; return; } } if(s[0]=='A' && s[n-1]=='B') { cout<<"NO"<<endl; return; }

cout<<"YES"<<endl;

} could anyone help me to know what thing I did wrong in A above is the code

  • 5 weeks ago, # ^ |

    You have to print "Yes", not "YES". Same for "No" and "NO"

5 weeks ago, # |

Can anyone plz tell me whats wrong here in my submission for problem B

  • 5 weeks ago, # ^ |

    Rev. 2  

    +1

    Consider the test case :- 6 5 4 ,
    Your O/P — 4
    Correct O/P — 2
    for value (5 and 6 only Alice will win )

    • 5 weeks ago, # ^ |

      Corrected that mistake but still getting WA on 3 test cases ;-; Here is my submission

      • 5 weeks ago, # ^ |

        Rev. 2  

        +1

        I'm not sure if binary search is a good idea here. You can try 30 10 3 correct ans: 7 your code gives: 9

      • 5 weeks ago, # ^ |

        Consider this test case :- 8 4 3
        Your O/P — 6
        Correct O/P — 4
        Aice wins game (4,5,6 and 8)
        Error is in line 58 loop that you are multiplying . They will depend on remainder of (n%a).

        • 5 weeks ago, # ^ |

          Thank you guys so much, my code got AC , there was implementation mistake at the end . In case anyone wants to see binary search solution — Here

  • 5 weeks ago, # ^ |

    Rev. 2  

    0

    your code doesn't handle the cases for in the range

5 weeks ago, # |

Can anyone please tell me whats wrong here in my submission for problem D?

  • 5 weeks ago, # ^ |

    I don't know how your code works, but it fails at the input 4 2

    • 5 weeks ago, # ^ |

    • 5 weeks ago, # ^ |

      It works in such way:

      So the dfs is expected to stop in very low depth.

      p.s. What about this one? It could pass 4 2.

      • 5 weeks ago, # ^ |

        It fails at 10000 0.

        The output has these three integers:

        -9999991 -9999937 -9999883
        • 5 weeks ago, # ^ |

          Sorry, but it got 9999991 -9999991 9999973 -9999973 9999971 ... here.

          Maybe there's some Undefined Behavior in my code?

          • 5 weeks ago, # ^ |

            It is not a UB, because the output is a set, and these three numbers are in it, which is against the constraint.

            Actually, they are not the first three numbers of the output on my computer as well.

      • 5 weeks ago, # ^ |

        Are you assuming primes don't have arithmetic sequences of length 3? Because that is not true, for example: .

        • 5 weeks ago, # ^ |

          Oh, that's it.

          Sincerely thanks for your help!

5 weeks ago, # |

C could be solved by writing a brute force and searching the sequence on OEIS. Maybe those problems should be avoided by for example having problems parametrized by some more values, or making sure it isn't easy to find on the internet. It makes the contest experience less fun, if the answer is easily found on the internet. Problems A and B were fine. Problem D also suffered from this issue.

  • 5 weeks ago, # ^ |

    Whoa, i didn't brute force on the actual answer tho, I bruteforced on a subproblem of it, The Catalan Numbers

    • 5 weeks ago, # ^ |

      Catalan numbers are well known.

5 weeks ago, # |

Rev. 3  

0

Why does this code give WA for problem A?

lng dp[3][SZ],n;string s;
lng solve(lng i,lng x)
{
 if(i==n-i){return 1;}
 if(i>n-i){return (x==0);}
 if(dp[x][i]!=-1){return dp[x][i];}
 lng j=(n-1)-i;
 char a=s[i],b=s[j];
 if(x==1){a='B';}
 if(x==2){b='A';}
 if(a==b)
 {
  lng z=solve(i+1,0);
  if(a=='A'){z=max(solve(i+1,1),z);}
  else{z=max(solve(i+1,2),z);}
  return dp[x][i]=z;
 }
 if(j-i==1){return 0;}
 if(a=='A'){return 0;}
 return dp[x][i]=max(solve(i+1,1),solve(i+1,2));
}
int main()
{
 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 cin >> n >> s;
 for(lng i=0;i<3;i++){for(lng j=0;j<SZ;j++){dp[i][j]=-1;}}
 if(solve(0,0)==1){cout << "Yes";rtr;}
 cout << "No";rtr;
 return 0;
}

Here lng=long long, rtr=return 0, SZ=2e5+7

5 weeks ago, # |

This was my first contest on AtCoder, Can someone tell me, when do the editorials be out ?

5 weeks ago, # |

nok0 My submission for A get AC but can be hacked with n=4 AAAA My submission

5 weeks ago, # |

Rev. 2  

+3

In problem A:

Why is "AB" a valid palindrome or can be changed to a palindrome according to editorial and tests?

  • 5 weeks ago, # ^ |

    AB doesn't satisfy the first condition (s[0] == "B" or s[-1] == "A") in the editorial.

5 weeks ago, # |

for D you can just use brute force to get a set meet the last restriction,and change the largest/smallest number,then add x to all numbers to get sum=M

base 3 solution is beautiful but not necessary

  • 5 weeks ago, # ^ |

    Can you share your submission?

5 weeks ago, # |

My solution to B in the contest seems to be wrong.

When , the answer is obvious 0, and when , Alice can win when , so the answer is .

When , Alice can win when , so between Game to Game , Alice can win games. Consider unexisted Game 0,There are groups of games, and there are ungrouped games, which Alice can win games. Therefore, the answer is

But it seems to be wrong and Here's my submission. I also found another AC submission with formula

I wonder what makes the answer passed and mine failed.

5 weeks ago, # |

I have different approaches for problem D and E:

Ingore the limit of sum for now. Let be the set of integers, one can find that

is good. Now consider the limit of sum. One can find that if we change the into , and add to some greatest elements in , it is still good.

We can change to () by performing operations in order.

Now we change into from right to left, taking the lexicological largest basis each time. It turns out that the number of operations is OK. (It can take up to operations to change a single number, but each operation will move some basis vectors to the right)

  • 5 weeks ago, # ^ |

    Your code on E submitted during contest can be hacked using the data generated by the code below.

    #include<bits/stdc++.h>
    #define rep(i,a,n) for (int i=(a);i<=(n);i++)
    
    int main() {
    	int n = 1000;
    	printf("%d\n", n);
    	rep(i, 0, 59) printf("%lld ", 1ll << i);
    	rep(i, 1, n - 60) printf("%lld ", (1ll << 60) - 1);
    	printf("\n");
    	rep(i, 0, 59) printf("%lld ", 1ll << i);
    	rep(i, 1, n - 60) printf("%lld ", (1ll << 60) - 1 - (i & 1));
    	return 0;
    }
    • 4 weeks ago, # ^ |

      Thanks for pointing this out! I tried to add some randomization and it worked pretty good.

5 weeks ago, # |

Rev. 2  

+39

My randomized solution for E:

If the answer is Yes, we first randomly manipulate the sequence for a small number of times, and then operate on index more than times repeatedly. Then we can (roughly) assume that is a linear combination of , where is about .

We can then solve with Gaussian elimination. If , operate on so that .

Then we operate on the second minimum element in . Then is removed from and all indices between and are added. Repeat this process until and operate on . Do this for and we are done. This solution uses ~60000 operations in randomly generated inputs.

implementation

UPD: More than 1000 random operations at first are needed to guarantee randomness.

5 weeks ago, # |

Can somebody explain here problem D, how exactly are we constructing the required set after we have figured out the base 3 condition where each digit should be 0/1.

5 weeks ago, # |

F is some wild generalization of IMO 1995 P6. I like it

5 weeks ago, # |

Such a magical problem D!

Base-3 representation is such a trick that could perfectly beat the rule of .

Next, by first keeping the rightmost digit of all n integers as zero and then change some of them to 1, so that . At the same time, all n integers are still distinct and satisfy the "good set" rule.

Finally, add to each integer so that , and at the same time, adding the same integer will not lead to any , although they may not belong to the "good set" anymore.

Thanks to the problem writer for coming up with such a clever and unbelievable construction problem!

5 weeks ago, # |

Rev. 2  

0

Was only able to solve A, although I misread the problem at first and somehow thought that I could use the operation only when adjacent characters are equal, lead to 3 WAs but we move....

5 weeks ago, # |

In terms of codeforces ratings, what would be the difficulty rating for problem A?

5 weeks ago, # |

can anyone explain logic of c plz?

5 weeks ago, # |

This round is good, arc should contain magical counting and constructing problems like this.

5 weeks ago, # |

Rev. 4  

0

A different way to think for D.

We can construct as follow (P is a set,initial ):

means add to all elements in .

And it can prove that for every triple of distinct elements in .

(Which is similar to the official editorial)

and we can construct the set with elements, and enumerate which two to delete. It can solve the problem.

  • 5 weeks ago, # ^ |

    Could you please talk more about why your construction will not lead to 2y=x+z? And, how to construct these n+2 elements, and how to determine which two to delete?

    Thank you so much for providing such a clever idea.

4 weeks ago, # |

Sorry for asking it late,

Can any one please the explain this line of editorial :

Here, if the elements in P are scanned from left to right, there must always be more left elements than right elements. The number of such arrangements corresponds to that of parenthesis sequences.

What I understood is that, lets say we have (1,2),(3,4),(5,6),(7,8) as corresponding (ai and bi).
Permutation : (1,2,4,3,5,6,7,8) have more right elements(2) than left elements(1) in first 3 elements (1,2,4) but still it can be divided it into two sequences A(1,3,5,7) and B(2,4,6,8), but in editorial it is told that it should not be possible ( as per I understood ) .
I know I have understood it wrong.
Anyone who did this problem or got the editorial please explain the line in blue

Editorial link : Link

100 minutes ago, # |

sorry for asking late. i'm confused about problem C on how/why the legal arrangement corresponds to parenthesis sequences. (that seems strange to me)

i know we are arranging some pairs like (1,2)(3,4)... , but in my opinion and based on some experiments and some comments like this. i claim an arrangement is legal if and only if there is no pair contains another pair.

for example, (1,2,3,4) legal because pair(1,2) and (3,4) doesn't contains the other. (1,3,2,4) is legal because two pair intersect not contain. (1,3,4,2) not legal because of containing.

however, if you see the pair as parentheses, (1,3,4,2) is legal because they can be mapped to "(())". that's a contradiction (do i misunderstand something?)

however again, when we consider the number of it, these two somehow are equal. here i take some example on n=3 to illustrate.

you see, if we take the view of parentheses, their correspondence(left parentheses and right parentheses) is really strange (at least differ from matching them greedily)

in general, i'm not negate the editorial, but i think i need some more clear intuition to understand this transform


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK