_Spongey's blog

By _Spongey, history, 11 months ago, In English

As per Cristofor's request I am making an editorial on the problems I solved:

Room Temperature:

Hint 1
Hint 2
Hint 3
Solution

Construction Project:

Hint 1
Solution

Marathon Race:

Spoiler
wasa855's Solution

Gift Exchange:

Grade
Hint 1
Hint 2
Solution
Implementation
Hint for Subtask 5

For the last problem "Road Service" I didn't understand what was written so I couldn't solve it lol

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By _Spongey, 11 months ago, In English

Last week, the Syrian Olympiad of Informatics finale took place, featuring a problem closely resembling the one found here Maximum Subarray Sum. The twist in this problem included an additional array, named B, where all elements $$$B_i \geq K$$$. The task was to find the Maximum Subarray Sum such that the sum of array $$$B$$$ for that subarray was less or equal than a given integer $$$K$$$.

For instance, with $$$N = 8$$$ and $$$K = 17$$$, given arrays: - Array A: -1 3 -2 5 3 -5 2 2 - Array B: 0 1 15 3 5 0 8 8

The correct answer wouldn't be 9, but 8 since there's a 15 blocking you from adding it. In the test, Also you can simply print 0 if the maximum answer is negative.

I approached this problem using the two-pointers technique, while I also explored a solution on USACO that utilized a set. My solution received an Accepted verdict on the CSES platform, but unfortunately, it failed a testcase on the SOI.

My AC Code on CSES

I may have wrote a different code cause I was sick, Idk, can someone telll me a case I fail?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By _Spongey, history, 12 months ago, In English

Hey guys, So for this problem, my approach was to like assign every node in the tree a value, which is how long or deep is it. (IDK what it's called but basically if we had a graph: 1 --> 2, 1 --> 3, 2 --> 4. Then the height of 1 is 2, height of 2 is 1, height of 3 and 4 is zero) My code failed on test 2, 25th test. So I was wondering what am I doing wrong (If it got me TLE I was planning to dp the height and just add 1 to it) 240029463 Here's my submission, and also this submission too 240023658

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By _Spongey, history, 12 months ago, In English

So, My approach was to find the first two numbers they are fibbonachi like for example 6, 8, 14, 22 let's call the first number n, and the second n... then the sequence is: n, m, n+m, n+2m...

My code 238882947 So I basically found the sequence of ns and ms k'th index (K is the length of the sequence given) and made a for loop to get every possible number that works for this solution it worked right for most test cases (In test#1 lol) and printed out the correct first and second numbers of the sequence

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it