C
C#9mo ago
hurikan

❔ Task (difficulty: easy)

in PDF:
100 Replies
hurikan
hurikan9mo ago
in images:
hurikan
hurikan9mo ago
No description
hurikan
hurikan9mo ago
No description
Jimmacle
Jimmacle9mo ago
...do you need help or are you waiting for someone to do it for you? $details
MODiX
MODiX9mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Esa
Esa9mo ago
is there a question here somewhere?
Hazel 🌊💃
Hazel 🌊💃9mo ago
$code
MODiX
MODiX9mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
hurikan
hurikan9mo ago
more like do it for me, because unfortunately I don't understand how to do it and I need some kind of reference so I can deal with these tasks for the future alone
Mayor McCheese
Mayor McCheese9mo ago
That's not really how it works
Jimmacle
Jimmacle9mo ago
yeah you'll learn from someone helping you through doing this yourself, not doing it for you we don't just do assignments for people
hurikan
hurikan9mo ago
ok does anybody want to help me doing this with me?
Jimmacle
Jimmacle9mo ago
that's why the channel exists
hurikan
hurikan9mo ago
alright, can you? please
Jimmacle
Jimmacle9mo ago
try it on your own, then when you get stuck ask about that specific part here
hurikan
hurikan9mo ago
I stucked on the assignment itself
Jimmacle
Jimmacle9mo ago
did you ask your teacher for clarification?
hurikan
hurikan9mo ago
it's not assignment from school, I don't have a teacher to help me
Jimmacle
Jimmacle9mo ago
where'd you get it from? if you don't even know where to begin maybe start with a simpler assignment?
hurikan
hurikan9mo ago
from voluntary seminar on the internet will you help me or not?
Jimmacle
Jimmacle9mo ago
once you explain where you're stuck, if i can figure it out then sure i don't currently have time to figure it all out for you
hurikan
hurikan9mo ago
what does the n mean? is it the empty squares in the picture?
Jimmacle
Jimmacle9mo ago
there are two ns referenced, which one are you talking about for both it looks like their meaning is immediately explained
hurikan
hurikan9mo ago
Each entry starts with a line with a number n (1 ≤ n ≤ 104), indicating the number of nodes to which you can send the data packet
it says that n indicates number of nodes to which we can send the data packet and I don't understand what are those.
Jimmacle
Jimmacle9mo ago
unless you're leaving out context then i don't either, because what you sent doesn't go into detail but it doesn't look relevant to solving the problem
hurikan
hurikan9mo ago
ahh ok
hurikan
hurikan9mo ago
now I don't understand this paragraph:
No description
hurikan
hurikan9mo ago
latency is like a delay, right?
Jimmacle
Jimmacle9mo ago
it explains what it means in the text start of the second paragraph of "input" i think you just need to read through the whole assignment, because it looks like it provides all the necessary information
hurikan
hurikan9mo ago
@Jimmacle I think I understand it more now after reading it precisely but I still don't understand this
hurikan
hurikan9mo ago
what is k = 3?
No description
Jimmacle
Jimmacle9mo ago
it tells you what k is in the very first line of the assignment
hurikan
hurikan9mo ago
ohh, the hell i'm blind sorry
Jimmacle
Jimmacle9mo ago
sounds like you need to... kapp
hurikan
hurikan9mo ago
🤣 what is a slot in the picture?
Jimmacle
Jimmacle9mo ago
what do you think it might be
hurikan
hurikan9mo ago
well here is k = 3 and I don't find any association with it in the picture
No description
hurikan
hurikan9mo ago
is it the square? I know it must look I'm totally dumb, maybe I am though But I really have some understanding issues here, let me read it once again @Jimmacle I don't want to bother you, but could you please explain the whole exercise in your own words?
Jimmacle
Jimmacle9mo ago
i didn't read the whole exercise but i see that in that example k = 3 and the image shows chunks of 3 slots, so they're probably related
hurikan
hurikan9mo ago
yes I thought that too, but then I saw this:
hurikan
hurikan9mo ago
No description
Jimmacle
Jimmacle9mo ago
read closely that is not picture 2
hurikan
hurikan9mo ago
oh my god, I'm so retar ded 😭 ok gimme a sec I will try to look at it once again Now I don't understand why in picture 1 there are 12 slots and in picture 2,3 there are just 8 slots what defines the amount of slots, is it the number n in input?
Jimmacle
Jimmacle9mo ago
no, they are iterations of the schedule there are an indeterminate number of them you have a schedule with k slots that runs in a loop, you're basically trying to fit all of your node communication in such a way that none of them overlap
hurikan
hurikan9mo ago
ahh so this is the basic schedule:
No description
hurikan
hurikan9mo ago
and the picture shows the loop
Jimmacle
Jimmacle9mo ago
yes
hurikan
hurikan9mo ago
ok now I also understand when schedule is valid or not but now I don't understand the output, let me read it and tell you what I don't understand after
hurikan
hurikan9mo ago
alright so this number 8:
No description
hurikan
hurikan9mo ago
means that k = 8 ? that there are 8 slots/nodes in the schedule? 8 latencies?
Jimmacle
Jimmacle9mo ago
re-read the part that describes the input format it tells you exactly what each line means you don't know how big the schedule is, because the point of the exercise is to find that value
Scott
Scott9mo ago
If the automod keeps blocking your post because you're using a slur, don't try to evade the automod
hurikan
hurikan9mo ago
I did that, I'm lost in the terms slot, node, schedule, latency, data packet ok
hurikan
hurikan9mo ago
so it doesn't work this way:
No description
Jimmacle
Jimmacle9mo ago
it might, that's what you have to find out you need to find the largest schedule that can correctly fit the nodes
hurikan
hurikan9mo ago
so the input for this:
hurikan
hurikan9mo ago
No description
hurikan
hurikan9mo ago
was:
3
6 9 3
3
6 9 3
? @Jimmacle and why is "3" repeating in every schedule, but "6" in every second schedule, and "9" in every third schedule?
hurikan
hurikan9mo ago
No description
hurikan
hurikan9mo ago
and not like this ^
Jimmacle
Jimmacle9mo ago
because that is the fundamental problem you are trying to solve if you treat the infinite loop of schedules as a flat line of cells, every node has to be N spaces away from itself where N is the latency and no two nodes can share a space
hurikan
hurikan9mo ago
OH OKAY - so the node "6" has latency 6 ms, that means it is 6 nodes away in the loop - the node "9" has latency 9 ms, that means it is 9 nodes away - and the node "3" is on every third node oh now I see the connection okay but what do I do now knowing that
Jimmacle
Jimmacle9mo ago
well, now you can start implementing the code to find that solution assuming you fully understand what you're trying to accomplish
hurikan
hurikan9mo ago
I don't I still don't understand how I come from this input 4 7 3 2 9 6 5 7 to this output 3
Jimmacle
Jimmacle9mo ago
i don't think you have to use every node, because otherwise that wouldn't be a valid solution you just use as many nodes as possible without breaking the rules defined by the problem
hurikan
hurikan9mo ago
I still don't understand can you just demonstrate the solution process on this input: 4 7 3 2 9 6 5 7 ?
Jimmacle
Jimmacle9mo ago
try solving it on paper
hurikan
hurikan9mo ago
yeah I'm trying to do that for 2 hours now I don't know how
Jimmacle
Jimmacle9mo ago
so the example solution gives you part of it, you know that the schedule will be 3 slots so you'll have to pick 3 numbers from that list then arrange them so that they don't overlap in future schedules
hurikan
hurikan9mo ago
ok I'll try to draw it on paper is the picking of 3 numbers just a trial and error? or is there some key to picking those 3 numbers
Jimmacle
Jimmacle9mo ago
brute forcing it is one solution, i don't know if it expects you to find a more optimized strategy
hurikan
hurikan9mo ago
but that means I will have to try every combination of 3 numbers out of those 8 and also every arrange combination?
Jimmacle
Jimmacle9mo ago
to brute force it, yes
hurikan
hurikan9mo ago
and do you know the non-bruteforcing method?
Jimmacle
Jimmacle9mo ago
no i'm not a math guy, but it seems like it's ultimately a math problem
hurikan
hurikan9mo ago
ok but with brute forcing there are thousands if not millions of combinations
Jimmacle
Jimmacle9mo ago
no there aren't you can calculate exactly how many possible combinations there are you have 8 numbers to choose and 3 slots, so 8 * 7 * 6 possible combinations
hurikan
hurikan9mo ago
but also the arrange combinations the correct order
Jimmacle
Jimmacle9mo ago
that calculation includes that possibility there are 336 ways to select and arrange 3 numbers from that set even if you didn't know the final k was 3, you have a hard upper limit on the size of k per the problem definition that says each slot in the first schedule must be filled, and a node can only appear in a schedule once so k cannot be larger than the smallest latency you choose
hurikan
hurikan9mo ago
ok and if there are 100 numbers to choose from the input?
Jimmacle
Jimmacle9mo ago
that's why you're writing a program to solve it
hurikan
hurikan9mo ago
there could be actually it's 10**4 does the order of those 3 picked numbers matter?
hurikan
hurikan9mo ago
No description
hurikan
hurikan9mo ago
or was this just a coincidence that they didn't overlap
Jimmacle
Jimmacle9mo ago
yes, the order matters to find the best solution if you didn't already know how big k was you wouldn't know if this is the best solution
hurikan
hurikan9mo ago
and how do I even do it if I don't know how big is k ? My simple question to you is: How do I get the k =3 from 4 7 3 2 9 6 5 7 ? Just on paper with pen what is the process of solving it
Jimmacle
Jimmacle9mo ago
the entire goal of the assignment is to find the biggest possible k
hurikan
hurikan9mo ago
yes
Jimmacle
Jimmacle9mo ago
what is the context for this assignment? because this isn't what i'd consider "easy"
hurikan
hurikan9mo ago
Those who did it considered it as easy
Jimmacle
Jimmacle9mo ago
which is why i'm curious what context this assignment was given under what kind of class/program is this for?
hurikan
hurikan9mo ago
it is voluntary seminar for high school students to practice their programming skills I asked those who did it and they answered that it was very easy and that it took them only 60 lines of code
Jimmacle
Jimmacle9mo ago
why not ask them to explain it to you?
hurikan
hurikan9mo ago
I did but they answer like once per half an hour Do you understand the task yourself? or like know how to do it?
Jimmacle
Jimmacle9mo ago
i would have to actually sit down and dedicate time to solving it and i'm currently at work i understand the goal, i don't have a complete solution off the top of my head
hurikan
hurikan9mo ago
yeah ok after this all time trying to understand and not knowing how to solve a task considered "EASY" I'm no longer thinking about programming as my future job I'm not sure if this is what I would like to do @Jimmacle I get it! A) 4 7 3 2 9 6 5 7 here the biggest k is 3 because the numbers are: 3, 6, 9 B) 1 2 2 3 3 4 4 4 8 9 here the biggest k is 4 because the numbers are: 4, 4, 4, 8 C) 5 5 5 5 5 5 5 5 5 5 here the biggest k is 5 because the numbers are: 5, 5, 5, 5, 5 I can explain to you why it is like that and you will tell me the procedure of the solution and then we can type the code. @Jimmacle I have the code! 🥳 I helped myself with ChatGPT but I got it. It works! at least on the example inputs and outputs
hurikan
hurikan9mo ago
Jimmacle
Jimmacle9mo ago
...this was never C#? KEKW you solved it at least
hurikan
hurikan9mo ago
It was C# all along. ChatGPT just started writing code in Python so I sticked to it for this task 😅 Thank you for helping me understand it! The program doesn't work for those extra large inputs. But it works for the small ones, at least something.
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts