« first day (1533 days earlier)      last day (3296 days later) » 

3:06 PM
hi @orlp
 
@Lembik hi
 
@orlp I resurrected my hankel question in a better and more approachable form
in case you wanted to know :)
 
I saw
I'm not entirely certain if it's non-trivial
there might be a closed form combinatorics solution
 
@orlp well it's trivial to do n = 3 which no one has managed yet :)
@orlp but I will award all my bounty to anyone who comes up with a closed form solution :)
 
Basically, there's 2^(2n - 1) hankel matrices
 
3:11 PM
@orlp yes indeed there are
 
so you need to figure out how many permutations of those there are, and a way to deal with duplicates
 
and we know there are <= (n!)^2 2^(2n - 1) hankelable matrices as a result
I think the first task is to actually look at some of these matrices for small n and see if column permutations are never actually needed
 
you're missing a subtraction sign there?
 
what do you mean?
 
(n!)^2 2^(2n - 1)
that's not a valid expression
 
3:13 PM
(n!)^2 times 2^(2n - 1)
the space means times :)
like z = xy means z = x times y
 
I know
but you generally avoid it when encoding math into ASCII
$\text{please mathjax chat, overlords}$
 
aha! we have mathjax
$(n!)^2 2^{2n - 1}$
 
eehm
I don't see it as mathjax'd?
I just see the source
 
just turned on chatjax.. thanks!
oh :)
 
you're trolling me?
 
3:15 PM
can you turn on chatjax too?
@orlp no of course not!
 
I'm confused
where do you turn on chatjax?
 
sorry what is confusing
"start ChatJax
^^drag this^^ to your bookmark bar or right click on it to add it as a bookmark. "
read that part
 
oh cool
 
so... the number of hankelable matrices is $\leq (n!)^2 2^{2n−1}$
but how much less I have no idea
 
You can just write $2^{2n-1}n!^2$
 
3:17 PM
until some starts posting answers :)
is it all clear now?
 
it's useless though
 
what is?
 
for larger $n$, $2^{2n-1}n!^2 > 2^{n^2}$
so we really haven't improved the bound :P
 
that's not right.. $n! = 2^{n \lg{n}}$
 
then am I being lied to by wolfram alpha?
 
3:22 PM
so $2^{2n-1} 2^{2n\lg{n}} = 2^{2n-1+2n\lg{n}}$
 
actually
 
which is a lot less than $2^{n^2}$
 
I misinterpreted the graphs
nah, it's a better bound nvm
 
:)
$n^2 > 2n-1+2n\lg{n}$ for large n
in any case.. I hope someone solves n = 3,4,5 so we can see what it looks like
 
$O(\exp{n^2})$ vs $O(\exp{n \log n})$
 
3:24 PM
right
it's massively smaller
 
I got thrown off by this graph
 
up to n = 2 :)
 
yea
it looked like it was going to keep rising though
 
what is your favourite programming language?
 
Python
 
3:25 PM
indeed :)
 
but I'm also very comfortable in C and C++
 
aha... so I think it should be quick to write a short naive python script for this problem.. right?
 
(to the point where I'm working on writing a new std::sort)
 
at least according to my naive view of python
 
a very naive script should be easy
be right back, toilet
 
3:27 PM
under the assumption that you are likely to be better than me in all languages....:)
@orlp I hope this isn't rude but would you be able to produce a really short and really naive python script so I can include in the question?
I just feel python is the right language for that
If I did it in C/Java it would look much more ugly
and I am sure you are a better coder :)
 
you're a mathematician, not a programmer?
 
exactly
I feel it would inspire others to post answers
if there was a short and naive solution in the question they could be better than
 
hey, sorting is O(N) if you know the distribution of the array, right?
 
@NathanMerrill it depends how well you know the distribution
@NathanMerrill can you be more precise?
 
@NathanMerrill can you clarify how much you know about the distribution of the array?
 
3:30 PM
@orlp snap :)
 
..not sure how to clarify
 
for example, my sorting algorithm runs in O(n) if it detects the input is ascending, descending or all equal: github.com/orlp/pdqsort
 
sure, but it would work even if you knew the values matched a bell curve
or any other curve
 
@NathanMerrill the general answer to your question is no
 
A bell curve, yes
Any curve, no
 
3:32 PM
why not?
 
because a curve defines a set of values
and that set may have arbitrary values
 
assuming the curve has a finite area under it
(above the x-axis, if needs be)
 
You know you can create a polynomial going through an arbitrary set of points, right?
and you can do this in O(n)
 
corrrect
 
then, by contradiction, if you can sort any curve in O(n), you can sort anything in O(n), by constructing a polynomial going through those points
hmm
not sure if that contradicts though
 
3:35 PM
that doesn't work
 
over the integers you can sort in O(n)
 
because to construct the points, you need to sort it in the first place
ok, here's an algorithm:
 
actually not true
you can't sort integers in O(n)
if the integers are unbounded
 
1. find the maximum and miminum of array.
 
@NathanMerrill no you don't
 
3:37 PM
@NathanMerrill You are distracting orlp from my challenge! :)
 
if your array you want to sort is [3, 5, 2, 1] you construct a polynomial going through (0, 3), (1, 5), (2, 2), (3, 1)
 
2. create a curve that is a summation of the values at each point
you would have to do this at each integer
or each N
 
then, if you can sort any curve in O(n) you can sort any array in O(n)
 
summation is the wrong word
count is what I mean
 
@NathanMerrill There is a nice cstheory.se question hidden in here :)
 
3:38 PM
@NathanMerrill do you understand what I'm saying in my proof of contradiction?
 
@orlp sure, but I don't know why my algorithm won't work
 
which is to prove an average case comparison model lower bound of Omega(n \lg{n}) for sorting
 
@Lembik this is not a comparison sort
 
@orlp ah ok... but still :)
 
@Lembik non-comparison sorts are better than comparison sorts, asymptotically
but are less powerful (e.g. only work for integers)
 
3:39 PM
@orlp well that's not really true. In practice quicksort is king
 
this one should work for any set of values
 
@orlp do you mean in theory?
 
you will have to round
 
@Lembik I edited in asymptotically
 
@orlp ok :)
 
3:40 PM
I wouldn't say quicksort is king though, radix sort can be very good
in comparison-based sorts quicksort is king
@Lembik did you read about my pattern-defeating quicksort?
 
@Sp3000 I did, but because in that challenge you can't see others, the possible strategies are limited. Hence I was thinking of making another challenge based on the idea without this restriction.
 
@orlp no.. sorry what do you mean by a pattern-defeating quicksort?
 
@orlp Google Code Jam, problem B
 
oh, I know why my algorithm won't work
 
3:43 PM
I'm basically inventing the radix sort
 
@user2428118 Ah k, making sure :)
 
with additional steps'
 
@orlp oh I see.. thanks!
@NathanMerrill :)
 
@Lembik good chance it'll become std::sort in C++
 
hi @Sp3000
@orlp ok cool. You will need interesting test cases I suppose
 
3:43 PM
I need to get on with CodeJam, time for C :/
 
I feel us PPCG question posers are being cheated on by people going to the code jam :)
 
lol
sorry for introducing it here
however, code jam really does have some great questions
 
@Sp3000 yeah I still haven't done B or C
 
hey, @MartinBüttner can you poke a hole in this algorithm?
 
I like B :) I just hope my algorithm is correct for large :/
 
3:48 PM
1. sort the plates
2. Take the first N elements (N starts at 1)
 
@NathanMerrill the least you can do is upvote my question now :)
 
3. sum them and split them into M parts (M = N + K where K starts at 0)
check the split and see if it is smaller than the N+1th element
if so, then set the new minimum amount of turns equal to K + (N+1)th element
repeat until the new minimum is greater than the original plate count
(by split, I meant divide evenly, rounding up)
@Lembik It was worse april fools day. I had a really great sandbox post but everybody was too busy clicking buttons
 
:)
 
ummm... honestly, I have no clue... this problem is somewhat beyond me. I think there's only one valid move (before letting everyone eat their pancakes), which is splitting all of the largest plates (equally). (well, do that repeatedly)
 
no
15 10
 
3:55 PM
yep
split 15 into 3 piles
then 10 is the largest
split 10 into two piles
let everyone eat
 
how do you know when to stop?
 
well that's the problem. maybe you can do it greedily, but I sort of doubt that.
 
I don't think so
 
it's also not obvious into how many piles to split
 
^ exactly
I feel like sqrt(sum()) should really be a part of the algorithm
or maybe sum()/2
 
3:59 PM
0
Q: Is integer sorting possible in O(n)?

orlpTo my knowledge there doesn't exist a $O(n)$ worst-case algorithm that solves the following problem: Given a sequence of integers of length $n$, find the permutation where every element is less than or equal to its successor. But is there a proof that it doesn't exist? Note that I'm not ...

 
have you looked at C?
 
no I haven't
I can though
 
@orlp I know the answer to that question
@orlp the answer is no
 
@Lembik feel free to add an answer
or quickly describe the gist of your proof or your reference here
 
@orlp I added a comment
@orlp there are no super linear lower bounds for anything
basically
 
4:03 PM
@Lembik I don't understand your comment - you're claiming $O(n)$ SAT might be possible?
 
yes of course
there is no proof that anything can't take linear time
 
If so, how does that possibility disprove $O(n)$ sorting?
 
it doesn't ..it is possible it might exist
 
"there is no proof that anything can't take linear time" <citation needed>
 
I am answer no to "But is there a proof that it doesn't exist?"
@orlp you can't cite the lack of something :)
 
4:04 PM
You state "there is no proof that anything can't take linear time" as if it is true
 
it is true
 
@MartinBüttner reading the problem...to prove it, I just have to prove that if I multiply all of them, it equals -1
 
if you are so convinced it is true, you must have a proof that proves "there is no proof that anything can't take linear time"
 
no :)
 
@NathanMerrill nope.
 
4:05 PM
that doesn't make any sense
 
because i * j * k = -1
 
2 1
ii
 
I am not sure there can't be any proof
 
@Lembik why not?
 
I am saying no one has found one
 
4:05 PM
you can argue about the provability of things
it makes perfect sense
 
see above
 
I think you're overgeneralizing
 
also:
3 1
jki
 
I don't even have any idea how to approach problem C... But does anyone know of some hard test cases for large input of problem D? I think I've got small input correct.
 
ah I misunderstood
 
4:09 PM
@BrainSteel large inputs are easy
 
I thought that I could introduce new variables
aka, reduce it all down to -1
 
@MartinBüttner ??
 
@Lembik to further clarify, P = NP hasn't been disproven
 
then expand it back up to ijk
 
for N >= 8, Gabriel always loses?
 
4:10 PM
@Sp3000 :)
 
Lies I say, lies
 
N >= 7 actually
 
@Lembik but it might very well been proven that the lower bound on the asymptotic worst case of SAT is more expensive than $O(n)$
 
Oh, yeah!
 
@Lembik P is a much larger set of complexities than just $O(n)$
 
4:11 PM
So, any tricky N = 6 test cases? :P
 
well...
 
@Lembik in fact, it's been proven SAT is not $O(n)$!!!
40
Q: What are the best current lower bounds on 3SAT?

Joe FitzsimonsWhat are the best current lower bounds for time and circuit depth for 3SAT?

 
3 x 14?
 
nvm
 
@MartinBüttner can you be greedy on C?
 
4:13 PM
I'm gna look stupid when 3SAT is not the same as SAT
 
@NathanMerrill hmmm
 
namely, can I take my first i and move onto j
 
yes
because anything you could exchange between an i and a j must be unity
that should make it much easier
 
is O(n) too slow?
is it possible to be faster?
@MartinBüttner
 
well you'll need to be able to collapse the repetitions
but that shouldn't be too hard
 
4:19 PM
@MartinBüttner If you take the length of the original sequence, and multiply it by 4, then that is the maximum amount of tries you should take to get a letter
because any sequence is reducible to 1, i, j, k (or their negatives)
all which have a maximum period of 4
 
I'm not entirely sure about the greedy thing any more... I've only considered exchanging quaternions between and i and a j... but what about between i and the k (by shifting the j completely)
hm I guess it probably doesn't matter
 
ok, lets say there is a set of 4 characters that make a unity between i and j
however, the first 2 characters make j
wait
...we have to ensure that all of the characters are reducable
 
of course
 
this means that anything after the j must be a unity
 
must be k, right?
 
4:23 PM
sorry, I mean after the k
 
basically, we need to ensure the pattern "uiujuku" where u is a unity
 
It's probably easier to just check prefixes of the string IMO
 
ugh I cannot be bothered to implement quaternions in Ruby :D
 
Hooray! 24 points :)
 
4:39 PM
I'm representing them as a tuple of (-1/1, 1/i/j/k) - surely there's a better way... :/
 
yeah I've been considering that
 
make em classes and overload operators
 
yeah I started doing that, but it got tedious with the signs
I'll just make a multiplication and a sign table now and then store them as pairs as Sp3000 said
 
That's neat and all, but don't forget that you probably do want to be fast on large input :P
 
lookup sounds much faster to me than computation
 
4:46 PM
@Lembik you here?
 
I absolutely think so
 
Should have probably had an (at)Nathan for that last comment
 
create a 8x8 table
 
hm yeah, might even do that
 
:P I was lazy
 
4:54 PM
okay, done
if anyone wants to string-replace it into the syntax of their language:
mul = { 1 => {1 =>  1, :i => :i, :j => :j, :k => :k,      -1 => -1, :I => :I, :J => :J, :K => :K},
       :i => {1 => :i, :i => -1, :j => :k, :k => :J,      -1 => :I, :I =>  1, :J => :K, :K => :j},
       :j => {1 => :j, :i => :K, :j => -1, :k => :i,      -1 => :J, :I => :k, :J =>  1, :K => :I},
       :k => {1 => :k, :i => :j, :j => :I, :k => -1,      -1 => :K, :I => :J, :J => :i, :K =>  1},

       -1 => {1 => -1, :i => :I, :j => :J, :k => :K,      -1 =>  1, :I => :i, :J => :j, :K => :k},
       :I => {1 => :I, :i =>  1, :j => :K, :k => :j,      -1 => :i, :I => -1, :J => :k, :K => :J},
 
5:20 PM
@orlp the link you pasted doesn't show what you said
@orlp it is a time/space tradeoff lower bound
see the answer of Lev Reyzin
 
I have an idea for an "efficient" solution of your problem
 
@NathanMerrill okay, I've got the greedy solution implemented
I think I'll just give it a go on the small test set
 
@Lembik you can permute the matrix of coefficients (abc bcd cde)
 
@orlp great!
 
after removing coefficient synonyms (in the default example you can swap a and e with no effects), you end up with $(N!)^2/2$ 'templates'
 
5:26 PM
that's an improvement :)
didn't you say you were no good at algorithms? :)
 
no?
can't recall
 
@NathanMerrill incorrect
 
oh maybe that was someone else.. sorry
@orlp I look forward to seeing the first answer :)
did you see that then starts the clock?
 
@Lembik a Hankelable matrix of size N*N must have one of the following forms: gist.githubusercontent.com/orlp/883cdcbc495b3d0021c3/raw/…
 
what does each line signify?
 
5:30 PM
each line is a form
the line is just the matrix compressed
 
N = 3?
 
yeah
sorry didn't mention that
abc
bcd
cde
 
well that's very interesting :)
 
becomes abcbcdcde
 
@NathanMerrill Hm, there's a mistake in my repetition-shortening logic.
 
5:32 PM
every line starts with abc because they are obviously free variables
@Lembik note that after permuting the original matrix I reassigned variable names, so the topleft most variable becomes a, then b, etc
@Lembik this gets rid of duplicates thanks to variable name synonyms
 
@NathanMerrill fixed. greedy solves at least the small input if done right.
 
hey code jammers, how does it exactly work? do you start at one time and have a limited time to complete everything afterwards?
 
you've got about 8 hours left for the entire thing
you can solve each of the tasks in your own time (within those 8 hours). when you're ready, you download the small test set and have 4 minutes to upload the solution. you can retry this (on newly generated test sets) as often as you want, but you lose some points with each resubmission
 
oh okay
then I'm going to start it
 
when you've solved the small test set, you can download one large test set and upload the result within 8 minutes, but you won't be informed whether that's correct until the end of the round
 
5:40 PM
I think they gave an additional 2h
 
@rcrmn I think those are already included in my 8 hours
 
Oh okay
Yep, the time at the top
hadn't seen it, thanks
 
you don't need to solve the large test sets to qualify
 
I don't like time-constrained competitive coding
it's not that I'm bad at performing under stress, I just don't enjoy it
I like to just calmly puzzle away
 
hm, do I try those pancakes or not...
I'm already qualified now.
 
5:47 PM
I'm reading the first one
In Case #3, one optimal solution is to add two audience members with Si = 2.
This doesn't make sense to me
 
why not?
 
Why would you add people with shyness level greater than 0?
 
oh, it doesn't really matter
but "optimal" is only determined by the number of people you add
and you'll need to add two people
 
why?
I mean
in this one you have
 
because there's a guy with shyness level 4, and only two people will get up before them
 
5:49 PM
1 09
WHAT
okay
the problem is the input file
 
off-by-one errors... ;)
 
4
4 11111
1 09
5 110011
0 1
I was reading the first 4 as it was one of the lines
 
the first line has the number of test cases
 
soooorry lol I'm a bit sleepy it seems
 

« first day (1533 days earlier)      last day (3296 days later) »