C
C#14mo ago
hurikan

❔ Task (difficulty: easy)

in PDF:
100 Replies
hurikan
hurikanOP14mo ago
in images:
hurikan
hurikanOP14mo ago
No description
hurikan
hurikanOP14mo ago
No description
Jimmacle
Jimmacle14mo ago
...do you need help or are you waiting for someone to do it for you? $details
MODiX
MODiX14mo 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
Esa14mo ago
is there a question here somewhere?
Hazel 🌊💃
Hazel 🌊💃14mo ago
$code
MODiX
MODiX14mo 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
hurikanOP14mo 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 McCheese14mo ago
That's not really how it works
Jimmacle
Jimmacle14mo 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
hurikanOP14mo ago
ok does anybody want to help me doing this with me?
Jimmacle
Jimmacle14mo ago
that's why the channel exists
hurikan
hurikanOP14mo ago
alright, can you? please
Jimmacle
Jimmacle14mo ago
try it on your own, then when you get stuck ask about that specific part here
hurikan
hurikanOP14mo ago
I stucked on the assignment itself
Jimmacle
Jimmacle14mo ago
did you ask your teacher for clarification?
hurikan
hurikanOP14mo ago
it's not assignment from school, I don't have a teacher to help me
Jimmacle
Jimmacle14mo ago
where'd you get it from? if you don't even know where to begin maybe start with a simpler assignment?
hurikan
hurikanOP14mo ago
from voluntary seminar on the internet will you help me or not?
Jimmacle
Jimmacle14mo 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
hurikanOP14mo ago
what does the n mean? is it the empty squares in the picture?
Jimmacle
Jimmacle14mo ago
there are two ns referenced, which one are you talking about for both it looks like their meaning is immediately explained
hurikan
hurikanOP14mo 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
Jimmacle14mo 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
hurikanOP14mo ago
ahh ok
hurikan
hurikanOP14mo ago
now I don't understand this paragraph:
No description
hurikan
hurikanOP14mo ago
latency is like a delay, right?
Jimmacle
Jimmacle14mo 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
hurikanOP14mo ago
@Jimmacle I think I understand it more now after reading it precisely but I still don't understand this
hurikan
hurikanOP14mo ago
what is k = 3?
No description
Jimmacle
Jimmacle14mo ago
it tells you what k is in the very first line of the assignment
hurikan
hurikanOP14mo ago
ohh, the hell i'm blind sorry
Jimmacle
Jimmacle14mo ago
sounds like you need to... kapp
hurikan
hurikanOP14mo ago
🤣 what is a slot in the picture?
Jimmacle
Jimmacle14mo ago
what do you think it might be
hurikan
hurikanOP14mo ago
well here is k = 3 and I don't find any association with it in the picture
No description
hurikan
hurikanOP14mo 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
Jimmacle14mo 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
hurikanOP14mo ago
yes I thought that too, but then I saw this:
hurikan
hurikanOP14mo ago
No description
Jimmacle
Jimmacle14mo ago
read closely that is not picture 2
hurikan
hurikanOP14mo 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
Jimmacle14mo 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
hurikanOP14mo ago
ahh so this is the basic schedule:
No description
hurikan
hurikanOP14mo ago
and the picture shows the loop
Jimmacle
Jimmacle14mo ago
yes
hurikan
hurikanOP14mo 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
hurikanOP14mo ago
alright so this number 8:
No description
hurikan
hurikanOP14mo ago
means that k = 8 ? that there are 8 slots/nodes in the schedule? 8 latencies?
Jimmacle
Jimmacle14mo 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_c
scott_c14mo ago
If the automod keeps blocking your post because you're using a slur, don't try to evade the automod
hurikan
hurikanOP14mo ago
I did that, I'm lost in the terms slot, node, schedule, latency, data packet ok
hurikan
hurikanOP14mo ago
so it doesn't work this way:
No description
Jimmacle
Jimmacle14mo 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
hurikanOP14mo ago
so the input for this:
hurikan
hurikanOP14mo ago
No description
hurikan
hurikanOP14mo 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
hurikanOP14mo ago
No description
hurikan
hurikanOP14mo ago
and not like this ^
Jimmacle
Jimmacle14mo 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
hurikanOP14mo 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
Jimmacle14mo ago
well, now you can start implementing the code to find that solution assuming you fully understand what you're trying to accomplish
hurikan
hurikanOP14mo 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
Jimmacle14mo 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
hurikanOP14mo 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
Jimmacle14mo ago
try solving it on paper
hurikan
hurikanOP14mo ago
yeah I'm trying to do that for 2 hours now I don't know how
Jimmacle
Jimmacle14mo 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
hurikanOP14mo 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
Jimmacle14mo ago
brute forcing it is one solution, i don't know if it expects you to find a more optimized strategy
hurikan
hurikanOP14mo ago
but that means I will have to try every combination of 3 numbers out of those 8 and also every arrange combination?
Jimmacle
Jimmacle14mo ago
to brute force it, yes
hurikan
hurikanOP14mo ago
and do you know the non-bruteforcing method?
Jimmacle
Jimmacle14mo ago
no i'm not a math guy, but it seems like it's ultimately a math problem
hurikan
hurikanOP14mo ago
ok but with brute forcing there are thousands if not millions of combinations
Jimmacle
Jimmacle14mo 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
hurikanOP14mo ago
but also the arrange combinations the correct order
Jimmacle
Jimmacle14mo 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
hurikanOP14mo ago
ok and if there are 100 numbers to choose from the input?
Jimmacle
Jimmacle14mo ago
that's why you're writing a program to solve it
hurikan
hurikanOP14mo ago
there could be actually it's 10**4 does the order of those 3 picked numbers matter?
hurikan
hurikanOP14mo ago
No description
hurikan
hurikanOP14mo ago
or was this just a coincidence that they didn't overlap
Jimmacle
Jimmacle14mo 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
hurikanOP14mo 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
Jimmacle14mo ago
the entire goal of the assignment is to find the biggest possible k
hurikan
hurikanOP14mo ago
yes
Jimmacle
Jimmacle14mo ago
what is the context for this assignment? because this isn't what i'd consider "easy"
hurikan
hurikanOP14mo ago
Those who did it considered it as easy
Jimmacle
Jimmacle14mo ago
which is why i'm curious what context this assignment was given under what kind of class/program is this for?
hurikan
hurikanOP14mo 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
Jimmacle14mo ago
why not ask them to explain it to you?
hurikan
hurikanOP14mo 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
Jimmacle14mo 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
hurikanOP14mo 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
hurikanOP14mo ago
Jimmacle
Jimmacle14mo ago
...this was never C#? KEKW you solved it at least
hurikan
hurikanOP14mo 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
Accord14mo 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