Hello Everyone!
I would like to invite you to CodeCraft-17, which will take place on Thursday 12th January 2017, 9:05PM IST. The round will be a Div1 + Div2 combined round and is rated.
Felicity, IIIT Hyderabad presents Threads ‘17, the magnificent annual technical fest, is finally here in its 13th edition! With a plethora of intellectually engaging online contests in various fields of programming, mathematics and general knowledge, Threads is a celebration of the spirit of computing and engineering. The grand algorithmic sprint called CodeCraft, parallel programming in Kernel Cruise, mathematical enigmas in Gordian Knot, jeopardy style CTF event called Break In, overall Threads '17 has something to offer for every kind of computing enthusiast!
I would like to thank Nikolay Kalinin (KAN) for helping us in preparing the contest,to Mike Mirzayanov (MikeMirzayanov) for the great Codeforces and Polygon platform and the Threads Team for helping in preparation of the problemset.
Prizes
- Top 25 participants win Codeforces T-shirts.
- Additionally, 25 randomly chosen participants from top-500 will also win a Codeforces T-shirt.
You will be given seven problems and three hours to solve them. The scoring distribution will be announced later. Good luck everyone!
UPD: The constraint of registration for eligibility to prizes has been removed. Everyone who participates in the round is eligible for prizes. Sorry for the inconvenience caused!
UPD2: Scoring is 500 — 1000 — 1500 — 2000 — 2500 — 2750 — 3500
UPD3:
The contest has ended. Thank you all for participating. Hope you liked the problems.
It was our first codeforces round and it was really exciting for us to see how the contest progressed!
Editorials and list of T-shirt winners will be published soon.
Congratulations to the winners!
UPD4: Editorial has been posted.
UPD5: The random t-shirts winners will be announced tomorrow according to the algorithm described in this comment.
Auto comment: topic has been updated by Baba (previous revision, new revision, compare).
Random --> there is a chance for Div.2 users :)
?
I hope one day i will get a T-shirt from Codeforces. that will be the best recognition of my hard work. I can't dream for a T-shirt in this round but some (+) rating.
randomly !! Come on there is nothing random in coding even random functions don't work randomly
Well, there are some ways to generate truly random numbers :)
How? And what does "truly random" even means?
Wiki
the random numbers are generated by alghorithm like von neoman or using the common method
(last number generated*constant + increament) MOD m
beacuse of that it's not truly random .. so the truly random numbers are the number which can really generated randomly by some waythat's what i meant and people sink me in much down vote(i don't like it)
I suppose there are 2 reasons for it: 1) Your colour. 2) What's the point of pointing that out? I am sure the words have appeared here many times before, so people here might be tired of seeing it.
aha you mean likeability and judgment.
1)likeability: as much as you have color tends to red as much as you may be right.
2)judgment: you probably writing that to get contribution.
it's not facebook guys there is no celebrities her as much practicing as much tend to red & as much u help others as much u get contributions
Why are you going too far?
We have absolute random here, You know, There's no logic behind the codeforces community's votes...
you're totally right sa1378. take my downvote
That's the way Patrick does it ;). Upvote...
huh! Not too randomized!!! Actually, the name of the writer, the color, his picture and then the comment is a little important!!! I like Sid! Upvote...!
UPD: To be honest, my rank in the CF's contests are more randomized(*_/*)! I wrongly read a problem again and I spend much of my time on it and then, BOOOMB! Hope you read all of your problem correct!!!
I like the second part of your username! upvote :))
Clarification: "An" means "Shit" in Persian...
And It was just a mistake in my username. (~) Hope I can change it next year!!! +_+
Time to say goodbye to grey and cyan, and restore my blue color :D
Looking forward to the longer contest :)
Auto comment: topic has been updated by Baba (previous revision, new revision, compare).
It is rated!
Longer time and fewer problems than Goodbye 2016.Wondering if the problems gonna be harder. How difficult will the problems be?
Any past contestants of CodeCraft can measure the problems difficulty equivalent to common rounds of codeforces for newcomers?
:-)
You may measure the problems difficulty yourself too. :D
Here are the last 3 year questions.
CodeCraft 2016 http://mirror.codeforces.com/gym/100889
CodeCraft 2015 http://mirror.codeforces.com/gym/100589
CodeCraft 2014 https://www.codechef.com/CDCRFT14
Thx! :)
** ** *****.
Here is something wrong with HTTPS certificate:
Could you check it?
You can add an exception in your browser to access it. Our ssl certificate is issued by startcom and it might not be installed. Let me know if the issue persists.
Why do you choose Certificate Authority "starcom"?
starcom is the worst choose CA, bcs it lost the trust. And it's not problem of my browser, it's a issue of CA because this CA abuse too many rules of creating certificates.
And "Starcom" was bought by "WoSign" who lost the trust too.
proof: mozilla blog, google blog
Could you use self-signed certificate? It is not better choose but it is better than starcom IMHO
From the post: Note : Don't forget to register on our website to be eligible for prizes.
The page for that registration is (perhaps?..) https://felicity.iiit.ac.in/threads/codecraft/
Aaaand, the Register link leads to...
https://felicity.iiit.ac.in//auth/login/
What's the matter with you people, asking to register before registration is even working? Edit: I mean, there are currently no means to associate a Codeforces account with the "registration" on your site.
Also, the site font is poorly readable in Firefox in a wide range of scales (but looks fine in Chrome).
For registration for prizes, all you need to do is create an account on our website with the "nick" same as your codeforces handle. In case the nick is already taken please send us a mail @ threads@felicity.iiit.ac.in.
You know, you could have mentioned the "same nick" part in your post before people try to register.
In some cases, mine and knst's included, what you ask for is impossible.
Sorry for the inconvenience.
Try again what? I've already registered under different nickname, since the site didn't allow my nickname to be used. And, I don't see any way to change it now.
Edit: From the post: UPD: The constraint of registration for eligibility to prizes has been removed. — Thank you, I like this solution!
Argh, was reading comments and registered there and only then I have read this UPD..
really? And what I should write? knst_SPACE_DELIMITER?
Wow, this contest has my mind firing on all sorts of topics.
CodeCraft — Beer. Craft Beer.
Felicity — I am thinking about the CW show Arrow when I see this, but when I see the the font, I think about FireFly. I don't even watch firefly. Something about it makes me think about it.
Last is Threads. I am thinking about some gangster and his threads.
Well, anyway, thanks for the mind simulation and I am looking forward to the round!
"Note : Don't forget to register on our website to be eligible for prizes."
I registered it on the website and it redirects me back to the front page. When I re-open the register page it still says "click here to register", what did I miss?
Once you have registered, you can login and update your account information. Don't forget to set your nick same as your codeforces handle. In case it's already taken, please send us a mail @ threads@felicity.iiit.ac.in
Sorry, I see no way to update account information on the Threads '17 site. Please do kindly provide a link, or instructions how to find it, if such a page exists.
I still get this page after registration, is this behaviour normal, or is it because of my nickname doesn't match with my CF handle?
Auto comment: topic has been updated by Baba (previous revision, new revision, compare).
Waiting for a round with codeforces stickers as presents.
what's the mechanism of the randomly chosen :/
int x=1+(rand()%500) ;
I think you mean
int x = 26 + (rand() % 474)
no it should be int x= 26+rand()%475 .
aka.Sohieb you are wrong. You forgot to include 500 in the range.
and when you get "Accepted"
Gordian knot looks interesting, is there some sort of archive of the past problems to have a look at?
Click
man thats from codecraft, i was asking about gordian knot, the project euler style event.
Wow, nice round. Never got a t-shirt ever. Good luck with me, haha.
Looks like this will be a magic round.
Will the drain be adjusted to the contest's length? If it was not planned to be, PLEASE DO SO :)! It was argued many times why not adjusted drain is a cancer and the longer duration the bigger cancer! Please, please, please.
Did you mean difficulty? Its impossible to do if asked before 3 hour of the contest. :(
drain describes how fast points gained from submitting drops
Thank you :)
Auto comment: topic has been updated by Baba (previous revision, new revision, compare).
My First Indian Contest, Hoping For A Positive Rating Change.... bharat mata ki jai....
bharat mata ki jai :)
all we can do is hoping for the good contest
Was the score for the problem just changed? Specifically what caused that?
why I can't register to the contest !!
same here!help!
Worst contest ever!
Please elaborate.
No, it was superb!
Pretest 12 on problem B is an immovable object..
I guess your initial value for ans is less than 1 and your code cannot output correct answer for this test case:
Use an unstoppable force on it. :)
for the first time I feel there is so much time left for the contest to end. :(
Great Contest ... hoping for the increment in rating !!! Best of luck Guys
testcase 5 1 1 1 1 1 answer is 1 this case sucks
after the contest gets over , help me solving problem C.I have done the mathematics behind it but dont know what algo to use and what data structure to implement my maths
Two pokemon of types i and j can be permuted if the number of occurences of pokemon type — i and j are equal in all the gyms.
Try to prove it.
My pretests passed though.
as is said i got the maths.You are correct.But i dont know what data structure to use and how to implement it.
I used hashing technique, but I'm not sure this is a wise way to solve this problem.
that moment ,when you help people but you can't help your self ... -hack A then you hacked !-
Did anyone solved problem C with hashes?
Ye i used hashes
Yes I did.
http://ideone.com/idEWaY can you tell me where i am going wrong ?
1 3 1 is not equal to 131
Yep.
Same here :D
Can someone explain how to do C?
For each pokemon type x, maintain a multiset of indexes of gyms containting x. Now form clusters of similar multisets. A cluster of size n can contribute n! ways to the answer.
Could you explain why the contribution is n! ?
It's the number of permutation. You can permute all the N pokemons (from that cluster) between them and the number of each pokemon type from that cluster is the same.
I did something very similar to that. Can I ask how you calculated n! mod m? And how you modded your answer variable in general?
m can be maximum 1e6 so just precalculate fact[i]%MOD (1<=i<=1e6)
but gyms and their count in that gym both must be same right??How do you deal with that
I used map< vector , int> cnt for that. But I don't know about its time complexity then solved it using hashing. Not sure if it will pass systest or not.
I used trie for counting numbers for each type, it works in O(N + M)
UPD: we can store a chains of pairs in trie, each chain describes how many pokemons of this type in each city.
Could you please elaborate your approach .
Here is my code http://mirror.codeforces.com/contest/757/submission/23752278
This code is not needed once we have access to this: 23747486
No maps, no tries — the code is very simple.
I wish I could think of simple solutions like that.
I am even more impressed by the fact that he came up with a solution in 4 minutes =)
I didn't know we can sort an array of vectors like he did.
Can you explain what is being done over here in this code !
Each vector a[i] has indices of pokemon gyms where this pokemon initially was. On sorting, the vectors get sorted among themselves.
Now, if a[i]=a[i-1]:
These two pokemons were present in the exact same gyms with same frequency in each of them. Now, we know that any permutation of such sets is a valid one, thus, we increment 't' and multiply to the ans.
eg- if input was
3 5
4 1 2 1 3
6 2 3 3 2 4 5
4 2 3 4 5
Then, a[] will look like this
1 : 1
2 : 1,2,2,3
3 : 1,2,2,3
4 : 2,3
5 : 2,3
ans = (1) * (1*2) * (1*2)
I cannot understand what you did after storing the indices of gym for each pokemon?
It's not what I did, it's what Tourist did.
He sorted the array of vectors. The sorting resulted in lexicographical sorting among the vectors. In my comment above, a[] looks like that due to lexicographical order. Each vector in a[] represents a pokemon( we don't care which pokemon it originally was, we just care about the vector it represents ). So, if two pokemons have same vector, this means, they can be evolved into each other. Similarly, if k pokemons have same vector, they can be evolved into each other( hence, answer for this group of pokemons is k! ). If two vectors are not same, then the corresponding pokemon can't be evolved into each other.
Let me add a few minor points.
Each
vector<int>
can be thought of as a type descriptor (not pokemon descriptor) and we compare those type descriptors with each other (not pokemons).Each type descriptor is composed out of pokemons (well, their's type).
Overall a quite good contest but it feels sad when the ranking are decided by number of successful hacks instead of speed of solving problems.
anta did 18 successful hacking attempt while tourist 10 (both are good)..... after that tourist solved problem 'G' and placed first.
WHY,WHY in problem D is needed to set limits up to 75?Why not 50??It is so strict.
Problem E is a very good problem to practice your oeis skills....
Please,pratice more before making a round,and even if you try don't put stupid problems with stupid observation and stupid limits.
How exactly did you use oeis?
Treat primes independently,you can easily get that you can deal only with px and only x is important,generate answers for n = 2, 4, 8, 16 and do oeis for every n with r = 0, 1, 2, 3, 4.
I did OEIS for two vectors with fixed N, saw that they are quadratic and cubic polys, interpolated and factored polys for many different N and saw a simple pattern:
A factor pe of N contributes to the product:
fix: r here is r from query increased by 2.
How to solve it, was it based on mobius function? Fr(n) was multiplicative, probably. Also I tried to use if p is prime, f0(p^a) = 2, f1(p^a) = 2a + 1, f2(p^a) = (a + 1)^2, f3(p^a) = (a+1)(a+2)(2a+3)/6, and then it got lost.
f_n(p^a) = f_{n-1}(1) + f_{n-1}(p) + f_{n-1}(p^2) + ... + f_{n-1}(p^a) = f_n(p^{a-1}) + f_{n-1}(p^a). I just used dynamic programming to precalculate all values.
No need for OEIS in E. It is just plain dynamic programing for O(MaxR * MaxPrimePower).
for problem B, with this input
3
3 3 3
the output is 3 ?
yep!
Yes.
I have copied one solution and on my computer the answer is 1, obviosly i hacked him, but got Unsuccessful hacked attempt, now I saw that on codeforces for same solution the answer is 1, why so ?
Did you copy or retype? (you can't copy during contest)
I think you have made mistake in typing his\her solution.
no, i didn't, i even made copy-paste(after contest) and the ansewer is 3.
but... it should be 3, right?
Can anybody explain how to solve D?
I used the following dynamic programming:
A state is a mask of already seen numbers (the largest number is always at most 20) and the position in the string.
A transition is just going from one position to some other to the right from it and adding the corresponding number to the mask.
This solution is fast enough if implemented properly.
The key observation is that out of the n*(n+1)/2 substrings, there can be at most n*5 substrings that correspond to numbers between 1 and 20, so you can cut a factor of n from the runtime.
You forgot about leading zeroes.
There are still at most 5 transitions. 0 is not allowed, so leading zeros only move the start of the valid range to the right. They can't increase its length.
Ahh, if we fix start of interval there are at most 5 ends, I missed that, nice.
Hacking is hard when you are colorblind...
What was the approach for problem E?Did it involve mobius inversions?
I noticed that the function is multiplicative. So I tried to solve for a prime power pe. Notice that
If you let then the above translates into
This recurrence is the same as counting monotone lattice paths from (0, 0) to (e, r). Combining with base cases, you can find the solution
Wow!
-_-
Problem B hacking case 3 1 1 1 output: 1
Fail...
To solve Problem D, I was using the fact the maximum number could be 20. Hence my DP array should be :DP[1<<20][75][75] (which is MLE) where the state of DP is(mask,idx,currentCuts). How can i optimize my memory ?
you dont need to keep track of currentCuts as you just need the total sum and not the actual value for each K
Thanks.It was to silly of me to put currentCuts in DP state.
Damn... But I have managed to squeeze into time and memory limits with keeping track of currentCuts :)
the friend residing in that city dies, so he is unhappy as well.
tourist again :( !
Hacking of C was so exciting.
For example, Errichto used XOR for hashing. So I wrote Gaussian elimination.
Errichto and wokop22's best strategy was submit a code just before the contest ends. So I don't have enough time to hack it.
And the result of this is Errichto's win. Congrats!
That sounds kind of contest-breaking, they shouldn't be about this.
I'll remember it as a viable strategy regardless. :D
I'm glad you had fun. And during the round I didn't realize that my solution is hackable because of xoring — so I learnt something today.
Hi. I am noticing many people this round who are colored red and rated Grandmaster. However, when I click on their profile, their rating is much less than 2400. Does anyone know why this is? Is it a bug with the website?
Lurk more.
Do you confirm that Santa Claus is real?
You have been here for 4 years. 4 years Carl!
it is magic
Thank you for good contest.
Special thanks to C (which can be solved without hashes :)) and E authors.
How did you solve C without hashing?
I used sums of rand()s, but it's basically the same thing as hashing.
One can show that storing the vector of pairs (gym, count) for all Pokemon is fast enough in the worst case.
What is the worst case complexity for such sorting and how can we prove it?
It depends on your choice of sorting algorithm. I don't know exactly what std::sort does, but it got AC.
Well, actually problem is about splitting pokemon types into clusters, where in one cluster number of pokemons of each type is same in each school.
Let's build this clusterization sequentially, adding school by school to it.
(You may ask here what "clusterization" is. Clusterization here is array c[i], which contains identifier of cluster for each type, one class will have same numbers, and different from all others).
So how to process a school?
Group pokemons together by type and count them (in each group, you will have pairs "type, count" after it). Then group pokemon types by number of pokemons in them. (This step can be done in ), don't touch pokemon types with zero pokemon count, it would be too slow).
Now we have "old clusterization" and new classes to split it.
Iterate over groups of types with same number of pokemons. Split each group by current clusterization. Take note, that each subgroup will have a common type.
So we will simply assign to c[i] some common unique value for all types in this subgroup. (How to get this unique value? Just maintain the maximum of current values in c[i]).
Remark. We just didn't payed attention to group with 0 pokemon types, but if you look carefully you will see, that it's c[i] don't need to be updated.
Remark. All steps above are done in time.
Remark. If you have troubles understanding text above, you may want to draw some pictures on paper -- draw a circle and split it's area into pieces. Consider this to be old clusterization. Add some more circles into previous one, it should have some non-trivial intersections with previous classes. Consider this to be groups of pokemon types with same number from new school, currently processed.
How do you store such clusters? I was trying to avoid sets/maps but in the end had to store clusters as sets, to allow quick removal (when intersecting one cluster with another). 23753670
As i said, I only store c[i] array. No need to store more.
My approach is intersection each class of pokemons within school with old clusterization. This way i get brand new clusters, which can be be enumerated and assigned to array back.
http://mirror.codeforces.com/contest/757/submission/23755165
I had a similar approach to @cdkrot's comment.
any ideas how to solve B? I found it quite hard to do it in O(N) or O(Nlogn)
If gcd(a, b) != 1, a and b have at least 1 prime in common. For each prime that divides each number do freq[prime]++ and take the greatest of frequencies.
I tried that with once with clasical prime factorization(23760980) first and then with sieve(23762396) and both time TLE on 11th pretest :(
what you are doing wrong is you are generating prime numbers uptil (100000).the prime number count uptil that is 9950.So your run time will be 10^4*10^5=10^9 approx. which will result in a tle on case 11 .I was having the sae problem.Then i did something smart .I calculated primes only uptil sqrt(10^5).And while traversing array i kept on dividing the arrays with these primes.At the end what was left in the array were themselves primes which u can count in an O(n) operation.So the complexity was brought down from 10^5*10^4 to 10^5*sqrt(10^5)=10^5*10^2=10^7 approx which is within time bounds
Instead of checking until X every time, save a vector for each number with the primes that divide it. Remember that the sieve is O(nloglogn) so the memory complexity of having the prime factorization is O(nloglogn) as well.
do something like sieve function.
Do the prime factorization of each element of array. Elements which have atleast one prime factor in common will have gcd>1,thus they can be included. Maintain an array x in which x[i] is the count of array elements which have x[i] as one of its prime factor. Answer will be the maximum x[i].
I did but got TLE code
Works O(mx * log(mx))
How?
N / 1 + N / 2 + N / 3 + ... N / N = N * (1 / 1 + 1 / 2 + 1 / 3 + ... + 1 / N) = N * log(N)
Not the time complexity but the explanation of solution.
gcd(x,y) = g implies x,y >= g and g | x,y .
The outer loop just fixes the gcd and the inner loop sums up the counts of all multiples of that gcd .
Am I the only who had been surprised when seeing Zlobober is asking this question and then noticed that it's zlobber not Zlobober? :/
Yay, I was also kinda surprised. Just wait until magic ends, and it will return to normal.
While this submission did not pass system testing (WA on test 82)...it was such a monumentally hilarious idea that I think it should be public..
23759222
wish no fst!
Thank you!
Really unusual problem set, not very hard, but no easy problem..
I tried to hack this solution for problem B. It uses strlen() for computing length in each iteration. So, I thought it would O(n*n) complexity. I gave input string of "zzz..." 10^5 times but it passed easily. Any help on why did it happened ?
A compiler can optimize it if the string doesn't change (it's not guaranteed, though).
Suprisingly, I successfully hacked another such solution(here) with the same case.
Its because he is using global variables. Hence (almost) no optimizations.
One solution uses GNU C11, the other uses GNU C++. Does this make the difference?
Modern compilers are smart, so perhaps they take this opportunity to optimize and place the calculation before the loop.
AFAIK, compiler is not optimizing semantics of strlen and other funcs.
But strlen's implementation is bloody fast -- it can be written using SSE for example.
Nice set of problems! Problem statements were well articulated.
Used hash in problem C, failed systest. #notcool#feelsbadman
your hash type is 32 bit, it means your hash value has 2^32 possible value, according to:
https://en.wikipedia.org/wiki/Birthday_attack and https://en.wikipedia.org/wiki/Birthday_problem
It says that if we have 10^6 object (pokemons) and hash value is 32 bit (2^32) the probability of at least 1 collision is over 99% no matter how good your hash function, but if we use 64 bit the probability of collision is far less than 1%
I'm curious if there are accepted user with 32-bit hash? I want to confirm wiki theorem :p
Actually my hash type is 64 bits, I used unsigned long long. but maybe my base 98317 is too weak.
I did it using two simultaneous hashes with different bases and got AC.
Passed using hashing here.
To prevent systest fail, I used three hash functions :) Here is my source!
This time lots of hacks & system failure !!!! :P
Can someone explain me this comment? Does it suggest that tourist invents better problems? I don't get it.
It refers to the CodeCraft tagline, "So you think you can code?"
Hmm...
mtomic the TOPPEST of ANIMALS!!! Take a bow son, take a bow!!!
And there were 104 tests...
congrats. you just got an AC.
Thanks, by declaring int nr[80][(1<<20)+100]; I got AC. I overextended a bit with the memory :).
Got WA on C because of low RAND_MAX. Gotta love Windows.
Me too.
Something like rand() * rand() + rand() would probably work.
EDIT: Confirmed, got AC with this change.
rand() * MAX_RAND + rand()
is better — all values can be achieved, assuming that consecutive calls of function are independent.Edit. As mareksom pointed out (thanks!), my way isn't perfect either. It isn't deterministic which of two rand's will be computed first and thus theoretically two runs of the same program can give different behaviour. So, it's better to do
int tmp = rand(); int big = tmp * MAX_RAND + rand()
.To be completely precise, assuming that
rand()
gives a uniformly distributed value on[0, RAND_MAX]
, and that two consecutive calls ofrand()
are independent random variables (that is not true, of course, but imagine that), to get a wider uniform distribution, you should useint tmp = rand(); int big = tmp * (RAND_MAX + 1) + rand()
, sinceRAND_MAX
(that is equal to, for example, 32767 under Windows) is an inclusive bound.Am I the only one who copied wrong spelling in hurry just because of this line in explanations
No. I've found at least 6 solutions doing this, in my room :|
Yeah, you literally killed your room :/ I guess it should be a record or something. And by record I mean placing 288th only solving 2 problems and 19 hacks :D
I once stood 49 based on just hacking and solving just 2 problems. (my third one failed system test). Link to round and Scoreboard
That was quite awesome :D On the other hand, today was a mixed contest of Div1 and Div2. So, 288th is kinda equivalent :D
I did it too!
How many tests were provided for G?
Because it is really bad feeling.
Someone made that solution accepted by changing one line(one cout to printf) — 23770624
Lol, really. Now it's much more unpleasantly.
Auto comment: topic has been updated by Baba (previous revision, new revision, compare).
here is a bug in system testing with my code 23767420 in problem 757E - Bash Plays with Functions my submission got WA on test case 57 while when i compiled on codechef ide with the same code it gave me the correct answer....i also faced the same problem of compilation before some time but it was on practice mode but this time it will affect my rating please resolve it if possible
Did you run the code with test case 57 as input (on the codechef IDE)?
yes i run my code with by taking 20 initial case of test case 57 and on codechef IDE it gave me the correct answer for those 20 case while on codeforces it gave me wrong answer on 1st case in 57 test case
Test cases for D are so weak! We don't have to use 20 to pass all cases.
I thought of getting TLE on C using just vectors and sortings without hashing. But it gets AC fast enough.
Awesome contest :)
Eventually red, gj)
Yay finally became orangy on my birthday :)
Yay finally I failed another contest, even though I scored F I won't get 2200 before my round :<
Why can the maximum number be 20 in problem D? I think it should be 16 only. Because minimum number of bits required to represent all numbers from 1 to 16 is 70. Minimum number of bits required to represent all numbers from 1 to 17 is 76. And the string length is only ≤ 75. Am I right?
You are wrong in your calculations, 74 is enough for 20.
Apparently not. Here is the string of length 74 which is a concatenation of binary representations of 1 to 20.
Yes, I miscalculated. My bad!
re-calculate the same again, its 74 bits required for 1-20.
What about problem F? I'm really curious.
Congrats rajat1603 for becoming red
magic is so buggy with rating changes!
Someone just copied tourist's code for problem G and got AC but using C++14 instead of C++11 heh
he also changed one cout to printf.
Yeah, and the funny thing is that neither changing cout to printf nor submitting under C++14 works for me :)
Resubmitting many times might probably help.
or add some comments :)
Another way to make it pass is to politely ask compiler to produce faster code using O3 (23772403).
I thought places like CF would have -O3 by default. Surprised to learn that isn't the case.
The default is -O2.
I heard from the problem setter that the expected solution was O(N * log(N)) and that only highly optimized O(N * log2(N)) should have passed.
During the contest I tried to submit the solution that does not use the fact we swap only the adjacent elements, but it used Cartesian trees and it worked about 6-7 seconds on maxtests. After the contest I managed to replace all Cartesian trees simply with vectors and binary searches, it still works in and fits in 2.1 sec: http://mirror.codeforces.com/contest/757/submission/23772311 Though, it now relies on that only the adjacent elements are swapped.
This solution may even be optimized to if we use fractional cascading technique, but it is much harder to implement and I'm not sure if it would significantly reduce the running time.
How could fractional cascading work? I think my approach is the same and I have thought about fractional cascading, but it seems like there may be too many children for each node so we can't store next-level pointer for every branch.
Seems you are right, I didn't notice that in contrary to segment tree in centroid decomposition we have many children. Looks like it makes impossible to find the right position in O(1) when moving from level to its child.
Ok, I don't know how to solve it in :)
I've just realized that if we ternarize the tree by adding d - 3 edges of zero length to each vertex of degree d > 3 (as described in the editorial), my approach works fine, since the centroid decomposition tree becomes no more than ternary and we need to store no more than three mappings from current level into children levels.
Right. It's funny that binary tree actually works better in a centroid decomposition solution in this case. :)
Well, I met a new problem when I tried to implement it: is there a simple way to maintain fractional cascading after a swap? Since swap is a relatively simple operation I guess there might be one, but I can't find it.
The TL of Problem G seems to be too tight!
Maybe the author has a better solution. If not I would be sad about these constant factors...
Anyway, I should foresee this before implemented it, but "solving the last problem" is really a beautiful fantasy :(
Edit: All right, I'm stupid. It seems like I used some unnecessary data structures...
When will the list of Tshirt winners be announced? Anytime soon?
3 101 Why answer is 5 in Problem D?
Oh, I counted 10|1| twice.. :X thanks!
How is F solved?
When will be editorial?
http://mirror.codeforces.com/contest/757/submission/23774954
Can anyone please help take a look why did this submission failed on test case 9? I spent some time on comparing it with some AC submissions and found out that the code went wrong starting on str[52], but I have no idea why did it cause the problem.
The range of your dp should be 2^20 instead of 2^19.
Ah... That was a really dumb mistake. Thanks for the help.
i figured a N*sqrt(N) solution for problem B ,by dividing each number of array with i,(n/i) and then taking the max of count of numbers each divides , but it fails on test #54 — link ,, any help?
There might exist an a[j] > sqrt(n) where a[i] = n/a[j] does not exist.
any editorial?
@tanujkhatter When will the editorial be released?
Baba When will the editorial be released?
Could anybody please explain how to solve D,i've tried to comprehend the solituon of tourist but didn't get it,and i can't wait until the editorial is published:)
I've used simple recursive search with memoizing and cutting search when there is not enough space to finish the sequence. Got AC with PyPy, 2.5s / 4s: 23765504
In problem C, why does 1. get TLE -
1. (Using unordered_map) http://mirror.codeforces.com/contest/757/submission/23759809
2. (Using map) http://mirror.codeforces.com/contest/757/submission/23779874
Isn't unordered_map supposed to be faster?
unordered_map can be hacked. See this: https://ipsc.ksp.sk/2014/real/problems/h.html
Thank you for this competition. Problems were very interesting. I like problem B.
where is the offical solutions?
What about Tshirts?
Auto comment: topic has been updated by Baba (previous revision, new revision, compare).
I wonder when the T-shirt winners will come out…
| every hour update the page with this blog...
Hey !! I was trying to attempt problem C and I think my logic is correct but I am getting a WA on test 31 and I am not able to figure out bug in my code http://mirror.codeforces.com/contest/757/submission/23790926. I think problem is related to string which is used in map but I am not able to understand, can anyone help on it ??
mp[x] += i+'0';
i can be big (> 256), so your solution incorrect.
I am not able to understand properly can you elaborate on it a little. Thanks
You seem to try to add a character
i + '0'
at the end of the hash of xmp[x]
, but in the value of a character must be under 128 (256 if unsigned char) while i can be as big as n. That is where and why it went wrong.Thanks!! I understood the problem.
It's time to announce how the random t-shirt winners are selected. We have a generator based on testlib.h (see code below) which will print the winning places. The seed will be the score of the first place in the tomorrow 8VC Venture Cup 2017 - Elimination Round.
What if there are two people with the same ranks?
"The seed will be the score of the first place in the tomorrow"
So if there are two people with the same ranks, score will be the same.
Challenge succeeded!
Within this procedure we will assume that ties are broken by the time of last AC.
There is a tiny chance of the following scenario:
3Yes: person A gets T-shirt.
3No: person A does stupid hack and gets -50 pts. goto 3.
61 84 129 162 170 190 227 239 247 251 272 292 312 344 352 355 363 365 386 415 420 433 442 443 466
That's true. This list of users will be announced a bit later.
Please announce the list of winning users, just for sure :D
The list has not been announced yet. :(
For the last t-shirt :)))
Nice
:( My rank is 291 :(
In problem C , getting WA on test 74 !! Stored all gym no. for each pokemon type in arralists and sorted ! Solution similar to that of tourist's ! http://mirror.codeforces.com/contest/757/submission/23807513 http://mirror.codeforces.com/contest/757/submission/23747486
The t-shirt winners are:
Congratulations!
Got Lucky !! 1st Codeforces Tshirt!! All thanks to tourist and the random function.
Best news in the day. Hope one day I will get the t-shirt by standing in the top 25. Thank you :D .
KAN, but what if the same place was divided by at least two participants?
http://mirror.codeforces.com/blog/entry/49663?#comment-337282
KAN Is there any restriction on some Countries ? where T-shirts can not be sent :/ .