ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1208. Legendary Teams Contest

A very nice tip that this problem had for me!
Posted by kerpoo 27 Jan 2015 02:10
I was getting TLE because it's bigget input is too small :)
It had a very nice tip:
nC2 > 3*nlogn (n>25)
&
nC2 <= 3*nlogn (n<25)

The maximum n was 18 so 18C2=153 > 3*18log18=216 and in a normal mode we often prefer nlogn solutions to n^2 solutions.
But in this problem max n was 18 and I tried many times to optimize my brute force solution (I was getting TLE for few extra ms) to get AC and I couldn't see the tip because n was so small :)
My 2^n*nC2 solution got AC but my 2^n*3*nlogn solution got TLE.

Edited by author 29.01.2015 13:48