last day (15 days later) » 

13:49
-3
Q: Send the pairs in smallest output

l4m2Write two programs A and B: Program A takes 1024 pairs of integers \$(a,b)\$, where \$0≤a<2^{32}\$ and \$0≤b<1024\$, and all \$a\$ will be different. It will output a single positive integer. Program B takes two inputs: the output-integer of program A, and one \$a\$ from the input pairs we've u...

I am voting to close as I am unable to understand the challenge. Please try to reformulate your first paragraph, fix some typos and consider using MathJax for your formulae.
@JonathanFrech Reformulating seems only make thing worse. In sandbox they're only saying there was no test data
@JonathanFrech The English is a bit hard to read, but not that hard... Which part you can't understand?
I've edited your post to fix the sentences and grammar to hopefully clarify everything a bit more. If I accidentally removed any rules or made an error in my edit, feel free to change it again.
What does "Smallest output" mean? Is it the sum of all of the outputted integers, or their total byte count?
13:49
@NathanMerrill Fixed.... (personally I think that it's a very minor point, regardless of whether the OP intend to take the mean, the median, or the mean when 10% smallest and 10% largest are removed, it does not affect what we have to do)
@user202729 I wasn't asking the question as a reason to close, but it does make a difference whether we measure in bytes or integers.
Should program A take a list of pairs or will it be ran several times?
@Soaku That's up to you. This is not code golf or speed code, so some converting point totally doesn't matter
Seems this problem is modified from one in uoj, but I forget and can't find
"It will output a single positive integer", in para one how to get output of the pair ? Any Criteria ?
Trivial nitpick: can we change “positive integer” to “nonnegative integer” just so we don’t have to insert adjustments by ±1 to avoid an incredibly unlikely output of 0?
13:49
@AndersKaseorg I'd suggest you still add a 1
@l4m2 The other answer has the same issue.
@AndersKaseorg For what input it outputs zero?
@l4m2 For example, 0 0; 1 0; 2 0; 3 0; …; 1023 0.
I'm lost ... program A takes input, I don't know what to do with that input but must output an integer. Maybe always 1? Then there is program B that is totally unrelated with the challenge scoring that is based on program A. Could someone explain?
@edc65 Program B is fed with program A's output. That's the relation.
@SyedHamzaHassan Your program have to handle that. The only restrictions are the ones listed in the question (ask if you find any restriction unclear). Figuring out how the task is possible is a part of the challenge, explaining that makes the challenge less interesting.
13:49
@user202729 so I ask again, could program A always output 1? I don't see any restriction about that in the challenge.
@edc65 Yes, but then the program B will not satisfy the restriction "It will output the b corresponding with the given a." <-- is that clear enough?
As I see it, program A has to compress the pairs given in its input and program B has to decompress. The score is what? size of program A´s output for the pre-test and/or test data?
I don’t know why people are downvoting this, it’s a perfectly fine challenge (despite the outstanding trivial complaint about disallowing 0). But perhaps a little anthropomorphization would help the people who think they don’t understand math: “Alice needs to send 1024 messages, one to each of her 1024 Bots, which are indistinguishable except that each has a unique 32-bit identifier. She wants to do this by encoding them all into a single number, which she wants to make as small as possible…” Or something? I dunno, honestly the math was fine as far as I’m concerned.
@Titus That's a possible approach, but there are better ways. The challenge is to figure it out. /// The score is "average value of the output of program A over a fixed collection of random test cases", as said in the post.
Ok, guess I understood. As I see it, the optimal approach is to A) find out what gcc rand() does without randomize() and B) what´s the common factor in your data generators, which I can only guess. Would you please clarify what you mean with with a different random source? A different definition of rnddgt()?
13:49
@Titus so users can't just try out the seed and output it.
I'm not sure why this was reopened. The fundamental problem of lacking an objective winning criterion has not been fixed.
@titus That would be considered optimizing for the test cases, because the program works much worse for other test cases.
@PeterTaylor That answer allows this challenge, and also have the highest vote count (together with your answer) (what's the consensus?)
@PeterTaylor The pretest data is provided with a TIO program that generates uniformly random test cases, and the challenge explains that the hidden test cases are produced by the same generator. It’s clear to me that the objective winning criterion is the smallest expected output integer over that uniform input distribution (and the hidden test cases are just a mechanism to prevent cheating when that is deterministically evaluated).
@AndersKaseorg I understand math quite well, I write code for a living, I hate anthropomorphization (and I hate having to write that word) and I find this challenge poorly worded and difficult to understand. And what about the demo program? The output should be a 26k digits number? Totally lost.
@edc65 Yes. Program A outputs a gigantic number (sure, it could be 26k digits, but the other answers here are a bit more efficient) that encodes, in any way that you choose, enough information about the input (a, b) pairs for program B to be able to recover each b given the corresponding a. How would you prefer for this to be explained?
13:49
@AndersKaseorg exactly like this, thanks
@edc65 Er, great! What did I say that was different?
@PeterTaylor Smallest average value of the output of program A over a fixed collection of random test cases wins. That´s pretty objective I think; as long as the collection is guaranteed to be fixed.
@Titus, but it isn't guaranteed to be fixed. If OP gets hit by a bus today, no-one will ever know what the scores should be.
@PeterTaylor If OP gets hit by a bus today, we generate new random test cases and get the same scores (within statistical tolerances), since we know exactly what distribution they’re drawn from. There’s no mystery at all about which objective the challenge asks us to optimize.
@AndersKaseorg, the way to turn the distribution into a truly objective criterion would be to require answers to optimise some parameter (arithmetic mean or maximum being the most obvious ones) over the entire distribution. That way all scores can be independently calculated and there's no need to trust that the choice of random numbers hasn't been fixed to favour one answer over another.
13:49
@PeterTaylor Indeed, in a world of free arbitrarily fast computation or omniscient mathematicians where we can evaluate all 9.208 · 10^10306 possible test cases, that would be a more precise way to evaluate the score. Lacking easy access to such a world, I see no reason to complain about the present method that uses a Monte Carlo approximation to this ideal. Especially given that the present answers are separated in score by thousands of orders of magnitude and an approximation error of a couple percent won’t make the slightest difference. Come on.
@PeterTaylor The OP scheduled a YouTube Video containing the test data or something. I´d be surprised if someone would hack it to win this challenge.
I'm not afraid if someone hack youtube for the test data; but i don't want to see someone use the currently best answer and subtract 1(mod 10^1000000)
@l4m2 That's a good observation, but letting the score be the floor log of the number would fix the problem.

last day (15 days later) »