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!
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.
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
n = number of rows
m = 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.
- 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.net/blog/entry/610char detCh(int i, int j){
return (char)((i+5*j)%26 + 'a');
}
and received AC.
you should check all neibours in 5x5 square :)
In the problem example, the output
aabb
aabb
bbaa
bbaa
is correct. How come? There must be smth else that I'm not taking into consideration.
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.
In case of W>=2 and N>=2 solution always exist.
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 for
N=3
W=10
ni: 2, 4, 3
?
:)
Problem B.
#include<iostream>
#include<string>
using 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;i<j-1;i++)
{
b=k(i);
if(b>1)
i+=b-1;
if(b!=0)
{
d=d+b;
}
else
{
d=0;
}
if(d>g)
g=d;
}
cout<<g<<endl;
cin>>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<j;i++)
{
if(a[i]=='(')
s++;
if(a[i]==')')
f++;
if(f==s)
{
n=i-h;
return n+1;
}
}
return n;
}
your answer: 4
correct(i think) answer: 8
BTW, your code passes under GNU C++