Good afternoon.
One more codeforces format round takes place this evening. I'm the author of the contest problems. Artem Rakhov and Maria Belova helped me to prepare the problems. Great thanks to them and all codeforces "fighters"!
I wish you good luck and funny hacks!
P.S: This round won't be rated. So your ratings won't change. That's because of severe problems with codeforces server. Read here for explanation.
Indeed, I don't seem to appear on the registration list, but I must have been registered or that pop-up wouldn't have appeared, right?
And I see a typo on the Score Table on the problems screen. "Successfull" and "Unsuccessfull" should each have only one "l" at the end.
Consider a single building: either you destroy it with some probability p, and you still have to destroy k-1 building, or you don´t destroy it(with a probability 1-p) and you still have to destroy k buildings. You can implement it using memoization for an O( n*k ) solution( with R fixed). That's why you see people talking about binary search + dp: you do bsearch over R.
cannot submit the code
cannot challange others
cannot watch the standing
only i can do ... goto bed at once ...
Just to init an array with length 260 or more.
One more thing,
in problem B, if i use printf("%lld\n",ans) it gives me wrong answer but accepts when i use cout<<ans.
Why?
With one test case per file cin/cout would be a better option :D.
The great problem was that "%lld" did not work properly on the server (GCC). I was not aware of this problem (on my computer it works well). This difference caused a lot of hacks in B. Sorry for that...
Though even is "%lld" worked properly the number of int64 hacks would be huge=(
I use Greedy + Binary Search, but it seems DP + Binary Search.
and test 10 for problem D please,thanks
okay....enough talk of server being busy...
can anyone point me my mistake for Problem B:
#include<vector>
#include<map>
#include<string>
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
map<char,long long > c;
unsigned long long int ans;
long long int j;
string s;
cin>>s;
j=0;
while(s[j]!='\0')
{
// if((s[i]<='z'&& s[i]>='a')||(s[i]>='0' && s[i]<='9'))
c[s[j]]++;
j++;
}
ans=0;
for(map<char,long long int>::iterator i = c.begin();i!=c.end();i++)
{
//printf("%d ",c[i]);
ans+=(*i).second*(*i).second;
}
printf("%llu",ans);
scanf("%*d");
return 0;
}
P.S In WinGW you must use %I64d for long long and double instead of long double.
I thought about octagon at the contest and used 8 points.
First of all let's prove, that if the root is not integer, it's unique (that is, it can appear only once):
Let x = -b + sqrt(d). In case x is also a root of another equation, there exists such u and v, that x = -u + sqrt(v). Then b - u = sqrt(d) - sqrt(v). That means, that difference between two square roots is integer, however one can prove that it is only possible when d and v are full squares, which isn't true (according to our assumption).
Now if x is not integer, then let's check if it can be root of some equation.
Since all roots are negative, for given x, we try to find negative y that
x+y >= -n
x*y <= m
Apparently such y can be 1 for odd x and 2 for even x.
Howerver, If you would started the description like.
"Vasja is playing a game. In this game he has to drop..."
It would be much more appropriate.
//#include is important to solve this problem be carfull to this]