sahaun's blog

By sahaun, history, 3 weeks ago, In English

Advent of Code 2024!

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.

The first puzzles will unlock on December 1st at midnight EST (UTC-5).

Full text and comments »

Tags aoc
  • Vote: I like it
  • +21
  • Vote: I do not like it

By sahaun, history, 7 months ago, In English

This is not a problem from any online judge, but for a project I am working on.

There is an ellipse and a list of points. The task is to score the list with a number between $$$0$$$ and $$$1$$$. A score of $$$1$$$ means that the list of points forms a perfect ellipse. A list forms a perfect ellipse when:

  1. All the points in the list lie on the circumference of the ellipse.

  2. The points are evenly spaced (distributed evenly) across the circumference.

Formal-ish statement

The expected time complexity is less than $$$O(N^3)$$$, not strictly necessary. $$$N$$$ being the number of points in the list.

If you want some inspiration, I have attempted the same problem but checked matching with circles and polygons. I am explaining how I did it for the circle.

Circle

How it works
Code

You can see how the same method will work for regular polygons. For irregular (closed) polygons, I have a more sophisticated but similar way. The closed polygon method can work for ellipses (since an ellipse is actually a closed polygon with many small lines), but I am looking for a more natural solution for ellipses.

Full text and comments »

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

By sahaun, history, 13 months ago, In English

Advent of Code 2023!

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.

The first puzzles will unlock on December 1st at midnight EST (UTC-5).

Full text and comments »

Tags aoc
  • Vote: I like it
  • +39
  • Vote: I do not like it

By sahaun, history, 23 months ago, In English

Hello!

We would like to invite you to participate in the Replay of AUST CSE Carnival 1.0 Programming Contest. It will be held on February 2, 2023 at 7:00 PM GMT+6. You will be given 11 problems and 4 hours to solve them.

AUST CSE Carnival 1.0 was a week-long event held at Ahsanullah University of Science and Technology (AUST). The event was organized by AUST CSE Society.

Participants with rating less than 1900 might find the problems interesting and/or educational.

Good luck!

Full text and comments »

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

By sahaun, history, 2 years ago, In English

I submitted exactly the same code for 86D - Мощный массив on different platforms. Here are the results:

There is a small increase in memory when using 64-bit, but the time difference is pretty huge!

Can anybody explain why?

Full text and comments »

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

By sahaun, history, 2 years ago, In English

The time limit per test 840D - Судьба is 2.5 seconds. But 157972351 passed in 3525 ms.

What's going on? ಠ_ಠ

Full text and comments »

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