« first day (875 days earlier)      last day (4079 days later) » 

12:00 AM
would've been a nice way to implement pseudo keyword-arguments
 
For example:
int x(2.0); // allowed
int x{2.0}; // prohibited
 
{1, 2.0, 3} // can't be an initializer_list
 
Shit. I'm ratted. I have to solve a protocol problem before Monday that is so bad that, if there was a suckage-fight between it and the supermassive black hole at the centre of the milky way, the protocol would win. That, and the insect got 12 stars for trolling.
 
Hello, Cruel World!
 
12:04 AM
@JerryCoffin Yeah, UI is basically just busted.
it's fine enough if you are dealing with a concrete type that you know
but in a template it's completely untrustworthy.
and if you're dealing with a concrete type that you know, then it's just syntactic sugar on the old kinds of initialization and doesn't really add much.
 
6 hours ago, by Borgleader
user image
:P
 
Well, they say negative publicity is better than none at all :D
 
In this case I don't think that applies.
 
#1 best seller rated 1 star, lol
 
12:09 AM
They're not getting bad publicity, they're getting burned at the stake
 
0
Q: chars in file to vector c++

Tyler SeymourI am trying to add every char in a file to a vector and print the size of the vector. This is not my end-goal, but it seems that I can't even get the chars to be added to the vector "rawdata". My program compiles and runs - but then it does nothing. I am using the stanford c++ lib.I am exper...

o.o
 
Xeo
@StackedCrooked lol
 
@Rapptz I was half expecting that sentence to go on like "I am expert" :p
 
Why do people use "strange" standard libraries?
 
12:16 AM
Unsubscribed from /r/funny, /r/pics. That stuff is crap.
 
@Borgleader What do you mean?
 
Well what's this "standard library" where std::vector is Vector and has an add method?
 
Java.
he simply didn't paste his real program.
 
Stanford library apparently
 
12:18 AM
boy, that course sucks cock.
 
@Borgleader It's the Standford library according to that poster.
 
Why can't he just use
int main() {
    std::ifstream in("example.txt");
    std::vector<char> chars;
    std::copy(std::istream_iterator<char>(in), std::istream_iterator<char>(), std::back_inserter(chars));
}
 
@Rapptz probably because he doesn't know how to do that ;-)
 
@Rapptz ideone it, and add comment with link :)
 
I'm pretty sure he doesn't know what an iterator is...
 
12:20 AM
could replace with a while loop and push_back
 
which he said he did...I asked for an example I/O to see.
 
What kind of course recreates std::vector..
 
far too many of them
 
Xeo
@Rapptz If anything, it should be one of the last exercises a course does.
 
They should make you do it, not provided you with a shitty vector clone
 
12:27 AM
IMO if you choose to remake it, go nuts, but I think after that you should toss it out
Not reuse it..
 
Hi there. I wrote a dll that hooks keyboard. The dll can be successfully injected, but the keyboard hook function doesn't work all the time. Is it because the injection method or the hook function? I've posted a question here: stackoverflow.com/questions/15305605/…
 
That's nice.
 
@Mysticial: so apparently in the bomb problem, 1 ≤ n,m ≤ 1000
so, the answer must be polytime
 
@nneonneo oh damn...
 
because O(k^1000000) will suck
yeah
 
12:29 AM
@nneonneo wasn't the answer he was looking for the minimum number of bombs though, not execution time?
 
@MickeyShine No drive by linking please
 
we all suck at ACM-style problems! woohoo!
 
@Bor
 
@melak47: yes
 
@Mick
 
12:30 AM
@melak
 
Xeo
@MickeyShine And we, like, totally don't care. Else we would've seen and answered your question without you needing to link it here.
 
but, basically, bounds like this mean that the problem must not be NP-hard
 
@Rapptz wat, that works? :o
 
yes
 
or there is some other bound or trick we're missing or not being told about
 
12:30 AM
@nneonneo But now that I think about it for a 3rd time, the greedy corner attacking algorithm seems to be optimal again. Furthermore, it might actually be O(n) to the number of squares.
 
eh?
 
Let's forget the degenerate cases where there are multiple corners close together.
 
btw, I think I have a fuzzy O((nm)^2) DP, but that's 1e12 which is still too big
 
Let's assume all the corners are far apart.
Note that my assumptions may be wrong and are enough to break the algorithm.
 
Sorry I just want find the answers to my questions
 
12:31 AM
ok
 
Xeo
@Borgleader Ow ow ow ow ow... my tummy hurts from laughing.
 
A corner piece will have 3 neighbors.
 
ok
 
Xeo
@MickeyShine And we just want to find peace from the endless streams of off-topic questions being dropped here. Thank you for your understanding.
 
If you nuke the one that's diagonal down (until the corner becomes zero), you've done a maximum reduction of the problem to a smaller size.
 
12:32 AM
well, you've deleted four of the corners
(all of the corners :P)
 
Yeah, I haven't begun to attack the cases where corners to close together.
 
we'll worry about that later. might just be bruteforce
at that point
 
Basically, the problem reduces to:
 
I must be thinking of the problem the wrong way
:|
 
Find a square such that there is only one neighbor to drop the bomb on such that the reduction is maximal.
For a square corner, that would be the one diagonal from it.
 
12:35 AM
ok, but for all other squares there are two possibilities?
 
@nneonneo There's only 4 places to you can nuke a square corner.
 
yes. but we always choose the one with maximum impact
 
If the corner has N. You must drop a minimum of N bombs.
 
i.e. the diagonal in
 
@nneonneo yes, but the diagonal encompasses all the other ones.
 
12:36 AM
yeah, so let's just assume the corners no longer exist
 
ooh, the bomb thing. I saw that :)
 
worstcase: I give you an input with corners all preset to zero
 
So you've just removed optimally reduced the size of the problem with no backtracking.
Now can be find a way to do this for all possible corners.
 
I agree with that. But there are no more corners.
 
The square corner (3 adjacent neighbors) has been taken care of.
 
12:37 AM
so we have (1,0), (0,1), (1,1)
those are "exposed"
 
000
0##
0##
^^ is done
 
no
that's not true...
`099
999
999`
 
00#
0##
0##
 
wait how do you write code in chat.
 
0 being empty, # being not empty
fixed font button
 
12:38 AM
@nneonneo the fixed font button for multiline
 
ctrl + a, ctrl + k
 
test
ah. it's still indent by four spaces. gotcha
sorry new to chat
 
no worries
 
ok, @Mysticial, what if the input is

0 4 4
4 9 9
4 9 9
 
Lemme enlarge them to make it clear which cases we're talking about.
 
12:39 AM
@nneonneo 9 minimum
 
with some more stuff outside
 
@nneonneo Yeah, that's not a standard corner.
 
because the mid is 9
 
I haven't started to attack those yet
 
"standard" corner??
ugh
I sense a combinatorial explosion in your future
:(
 
Xeo
12:41 AM
I think I'll leave you smart guys alone until you find the solution and then silently steal it. :)
6
 
bah, I used to be good at ACM problems in undergrad. maybe I should just call out to one of my old colleagues for help on this.
:P
 
@Xeo great idea :D
 
Let's try this case first:
 
does it become any easier if we allow a bomb to drop fields below 0, and just regard "all fields <= 0" == win? :/
 
00000
00111
01111
01111
01111
 
12:42 AM
@melak47: same thing, really
 
1 message moved to bin
 
user1357851
yes I know you would do that Mystical
 
Is bombing the middle still maximum and all encompassing?
 
@Telkitty we're trying to have a serious discussion here! :p
 
is that the whole field
the minimum number of bombs must be 3
I think
 
user1357851
12:43 AM
@melak47 as always :p
 
@nneonneo yeah, middle in that whole 5 by 5 grid.
 
no, middle is decidedly nonoptimal
r3c3
 
@nneonneo We're not trying to clear it. We're just trying to reduce it.
 
the optimal moves are r3c4, r4c3 and r4c4
 
monospaced font is not enough...we need quadratic monospaced!
 
12:44 AM
bombing the middle will give you the wrong answer
 
@nneonneo You're numbering from the top-left right?
 
1,1 at top left, matrix style
 
k
lemme think
fuck, you're right.
 
well, by the usual corner argument, you have to bomb r4c4 in order to cover corner r5c5
 
So we have a branch here that requires back-tracking.
 
12:45 AM
so we just apply the corner heuristic first??
 
Let's step back a bit. Can we skip these cases?
If we can always find a case that is maximum and encompassing?
 
sorry, can you define that?
the terminology
p.s. you're a grad student, right?
 
@nneonneo Meaning, that the maximum reduction bomb includes all other possibilities. In other words, there's nothing to branch back to.
@nneonneo yes
 
@nneonneo The square corner case has a maximum reduction/all encompassing solution. (which is to bomb the diagonal square until the corner disappears.)
 
12:47 AM
right
I think that reducing the corners to zero has priority over anything else you try
 
Now I'm trying to see if every single possible shape always has a "maximum reduction/all encompassing" step that can be exploited.
 
so you can always assume the input has corners reduced to zero
 
Lemme try to create a circle.
 
fun fact: in
00000
00111
01111
01111
01110
 
@nneonneo That one has two square corners.
 
12:49 AM
does it?
ob yeah
 
Yep
 
durr
 
But you see what I'm trying to get at right?
Is there always a square corner to attack?
Aside from degenerate cases.
And if there are no square corners. Are there any other patterns that have a "maximum reduction/all encompassing" step.
 
ok
so what's the optimal solution for
 
If that holds, then we have a linear-time algorithm.
 
12:50 AM
0 3 3 3 0
3 3 3 3 3
3 3 3 3 3
3 3 3 3 3
0 3 3 3 0
 
@nneonneo So that does not have any square corners.
 
yeah
 
basically the circle case I was trying make.
 
and I'm actually not sure what the best solution is
it's at most 12 obviously
 
It can be done in 4 * 3.
 
12:51 AM
ya
 
Xeo
@Mysticial It does if you think of it as 4 overlapping 3x3 squares
 
...I guess there's no better solution
hrm
 
@Xeo It gets messier when the numbers are different.
So it's possible to create a shape with only "snipped" corners.
Which have two different maximum reductions... shit
 
Xeo
@Mysticial There should be a way to split it so that you distribute the numbers of a spot on all squares.
I'm just throwing out random thoughts btw
 
I can tell. :)
Note that we're still on the polygon case. We haven't even started to attack "islands" and "rivers".
 
12:54 AM
gawd
 
So there's very well too many cases to make this approach feasible.
 
I'm convinced that there's just a nice little DP
 
I'm convinced there's a DP algorithm that gets close to optimal. But not necessarily optimal.
 
DPs usually are optimal if you build the DP along the right lines
 
Xeo
Gah, I don't want to think about it because I know I won't be able to find a solution, but thinking about it is kinda fun... ugh
 
12:57 AM
god, there's so much random nonsense on that page though
even if we did get a good algorithm it might be hard to rise up above the noise
 
@nneonneo You would basically need a direct reddit link to the answer.
 
because now I'm convinced a good algorithm would have to come with a rigourous proof
lmao
yeah, that would do it
 
Yeah the snipped corner case has 2 branches.
And it gets worse from there.
Consider the diagonal case:
0001
0011
0111
1111
 
Xeo
@Mysticial Meh, not that hard to beat 15 upvotes, really.
If you really have a solution, just dropping the link in here should do.
 
not with the sheer power of reddit
 
12:59 AM
@Xeo The most I've even come back from and beaten was a +10.
 
and/or Lounge<C++> :P
 

« first day (875 days earlier)      last day (4079 days later) »