### Nedy88's blog

By Nedy88, 11 years ago, Hello everybody,

Codeforces Beta Round #26 will be held on Monday, the 16th of August, at 19:00 MSK. It will be Codeforces format round, and if all goes well it will be rated. Authors of the problems are Artem Rakhov and me. Thanks to Mike Mirzayanov and Dmitry Matov for help in organizing it. Also thanks to Julia Satushina for translation of problems.

Good luck, see you on the round!

UPD: The contest is over, thank you to everyone for participating. Announcement of Codeforces Beta Round #26 (Codeforces format)  Comments (43)
 Hey , if u don't mind can i ask one personal question?Were u guys working on the Testing Process or Development of Codeforces Format round these days? Or it was just bcz u are busy with ur works.?I am eager to know bcz i have with been the codeforces since its 3rd round. Thanks
 I asked a question, but I think I more or less understand the problem. Each attempt costs 50 points. After I made successful one, next unsuccessful attempts costs nothing, but what happens after I made next successful one? Will all attempts before the last successful be counted as -50?
•  I believe the answer to that will be "Yes".  See Codeforces format description 8:You may resubmit the solution at any moment, but it may reduce your score. It happens if resubmission is successful (i.e. passes all the pretests + previous hacking attempts). In this case, the previous successful attempt would be considered as a reason for penalty (see item 3).
•  http://en.wikipedia.org/wiki/Bertrand%27s_ballot_theorem
•  that was to your later post that's below
•  This helps. Thanks.
 Can someone throw some light on how to work out D. Tickets?  I see from ACed solution that the formula is 1.0 - (n! m!)/((m-k-1)! (n+k+1)!).  But, why?
•  It can be solved similar to calculating Catalan numbers by method of refelection. (see wikipedia)
 Oh!I really loved itwhen is the next round?
•  Can someone answer me,please?
 can any one explain how to solve problem C? i tried to solve it using brute force appraoch but it gives me time limit?can any one explain the solution and thanks in advance.
•  Split the problem in cases:n = number of rowsm = number of cols* n and m are odd -> No solution* n is odd -> Fill the first row using pieces of type a -> now, n and m are even* m is odd -> Fill the first column using pieces of type b -> now, n and m are even* n and m are even -> Fill the matrix using blocks of size 2 * 2 (two pieces of type a, two pieces of type b or one piece of type c). If you are in the cell (i, j) you have to check the cells (i - 1, j), (i - 1, j + 1), (i, j - 1), (i + 1, j - 1) in order to calculate the chars you can use for the current block (remember that if you're using a block of two pieces of type a or b, you will have to use 2 different chars), now use one available 2x2 block  (if there is no available block -> No solution), update the pieces and go for the next non-filled cell.
•  Thanks so much. i solved it.
•  Interesting.  Why does this approach always gives a solution whenever possible?
•  The first case is trivial: Pieces with even area and the total area is odd.The second case: n is odd. We can't fill any column using only pieces of 2 x 1 and 2 x 2, because, at end, always, there will be 1 non-filled cell. So, in any moment we will need a 1 x 2 piece, then, used in the first row and fill all cells in that row (one 1 x 2 piece fill two cells, and the number of cols is even) if we have more than m / 2 pieces.The third case: almost same explanation that the second case.[In both cases (second and third) we get a matrix where m and n are even.]The last case: n and m are even. n * m = (2 * n') * (2 * m') = 4 * n' * m' (for n', m' >= 0). The area of the matrix is multiple of 4, then, we can filled it using pieces of area 4 (2 x 2, 2 x (1 x 2) or 2 x (2 x 1)) if we have enough (a / 2 + b / 2 + c >= (m * n) / 4).adamax wrote a tutorial about beta round 26. You can find it here -> http://codeforces.com/blog/entry/610
 Can anybody give me test case 5 of problem E?
•  Sorry. Did a silly mistake. Got Accepted.
 Can Anyone explain me the solution of problem C? I tried it but didn't get the correct approach... :(
 Hint on test 9? Must have an implementation bug.
•  i replaced your detCh function with mine:char detCh(int i, int j){    return (char)((i+5*j)%26 + 'a');}and received AC.you should check all neibours in 5x5 square :)
•  Thanks a lot.
 I got AC to. But still I think there is a problem I don't understand.In the problem example, the outputaabbaabbbbaabbaais correct. How come? There must be smth else that I'm not taking into consideration.
 I've thought about it some more and I found that by checking only N,S,W,E neighbours there is a testcacse I would fail(also taking into consideration that by checking a 5*5 square I would AC).The test is 2 4 2 2 0. So I need to check SW also. Actually with a little bit more attention I concluded that I only need to check N, W neighbours when I place a or c type boards and when I place b boards I need to check N,W, SW neighbours.
 Me again, sorry for overposting. Could you help me with problem E's  Presentation Error on test 35?
•  In case of W>=2 and N>=2 solution always exist.
•  This comment is weird. I get a comment with no author and an author without a comment :))If for w>=2 and N >=2 always exists solution, then what is the answer forN=3W=10ni: 2, 4, 3?
•  Of course we should have w  ≤  sum(ni) as well. Try my tutorial:)
•  This is straight-up advertising. Fair competition though. Still my problem remains. Gotta debug more
 Bug Found. Problem ACed. Thank you all.
 Why WA on test3?Problem B.#include#includeusing namespace std;string a;long int k(long int );int main(){cin>>a;long int j=a.length(),b,d=0,g=0;long int c=0; for(long int i=0;i1)         i+=b-1;         if(b!=0)         {         d=d+b;         }         else         {         d=0;         }         if(d>g)         g=d;} cout<>g;return 0;}long int k(long int h){    if(a[h]==')')    return 0;    long int s=0,f=0,n=0,j;    j=a.length();    for(long int i=h;i
•  test: ()())()()your answer: 4correct(i think) answer: 8
 I wrote the following for A. prime numbers but i am getting WA on test case 11. Can anybody help?#include#include#include#include#include#include#include#includeusing namespace std;int main(){ bool check; for(int i=0;i<70;i++) check[i] = false; check = 1; check = 1; vector primes; for(int i=0;i*i<3000;i++) { if(check[i]==0) { primes.push_back(i); for(int j=i*i;j*j<3000;j+=i) check[j] = true; } } int n; cin>>n; int last =0; for(int i=2;i<=n;i++) { int count =0; for(int j=0;ji) break; else if(i%primes[j]==0) count++; } if(count==2) last++; } cout<
•  You can't simply ignore primes larger than 70. For example, the number 142 is almost prime, but according to your code it's not.
•  yeah got it..right
 when will be the next contest?
 Next Contest !!!!??????????
•  10th sept
 Why RTE???#include#include#include#includeusing namespace std;#define max 3500bool prime[max];void sieve(){ int i, j; for(i=1;i<=max;i++)prime[i]=1; for(i=2;i>high){int i,j; vectorcount(max,0);long cou=0; for( i=low;i<=high;i++) { if(!prime[i]) for(j=low;j<=high;j++)if(prime[j])if(i%j==0)count[i]++; } for(i=low;i<=high;i++)if(count[i]==3)cou++; cout<
•  Accessing prime[max] is undefined behaviour, AFAIK.BTW, your code passes under GNU C++
•  no prblem, I got AC. :) There was mistake of the declaring the value of low before while(). Just change the low value under while() and got AC. :DThank you
•  Got AC