COMPETITIVE PROGRAMMING

Topcoder Single Round Matches (SRMs) are the OG of Competitive Programming.

THE BEST PROBLEMS

Topcoder has some of the best algorithm problems on the planet.

View Past SRMs
COMPETITIVE PROGRAMMING ARENA

We have the vintage Arena and the Web Arena to pick from.

CALENDAR

Find out when our next SRM will take place.

Learn More

SRM PROBLEM SAMPLE

Here is one of our easy problems from a past SRM to get you revved up. All our problems can be solved with Java, C++, C#, VB, or Python.

Problem Statement

You are given the ints perimeter and area. Your task is to find a triangle with the following properties:

  • The coordinates of each vertex are integers between 0 and 3000, inclusive.
  • The perimeter of the triangle must be exactly perimeter, and its area must be exactly area.

f there are multiple solutions, you may choose any of them. Return a int[] with six elements: {x1, y1, x2, y2, x3, y3}, where (x1, y1), (x2, y2), and (x3, y3) are the coordinates of the vertices of your triangle. If there is no solution, return an empty int[] instead.

Definition

Class: FindThePerfectTriangle
Method: constructTriangle
Parameters: int, int
Returns: int[]
Method signature: int[] constructTriangle(int area, int perimeter)
(be sure your method is public)

Constraints
  • area will be between 1 and 1,000,000, inclusive.
  • perimeter will be between 1 and 1000, inclusive.
Examples

0)
6
11
Returns: { }
There are no valid triangles with area 6 and perimeter 11.
1)


6
12
Returns: {1, 1, 1, 4, 5, 4 }
The example output describes a right triangle with vertices at (1, 1), (1, 4) and (5, 4). Its sides have lengths 3, 4, and 5, hence its perimeter is 12. The area of the triangle is (3*4)/2 = 6.

2)37128
882
Returns: {137, 137, 273, 410, 1, 410 }
3)12
18
Returns: {1, 1, 4, 5, 1, 9 }
In this test case our solution constructed an isosceles triangle with vertices at (1, 1), (4, 5) and (1, 9).
4)18096
928
Returns: {1, 1, 1, 88, 417, 88 }
5)1000000
1000
Returns: { }

CHOOSE A COMPETITION ARENA

You can try the vintage Topcoder Arena to download, where most of our veterans like to hang out, or if you’re a newbie, the Web Arena may be how you submit your first problem.

TOPCODER WEB ARENA

This Topcoder Web Arena is easy to jump right into and perfect for newbies at Topcoder.

Vintage Topcoder Applet Arena

If you like bringing it way back to the originals, like the NES, you’ll love our Vintage Topcoder Applet Arena. You’ll have to download and install, but there’s just something about nostalgia you can’t get enough of.

COMPETITIVE PROGRAMMING RESOURCES

At Topcoder there are multiple ways to learn about competitive programming, from reading Thrive articles to checking previous matches solutions and editorials and many others.

LEARN WITH THRIVE

Whether you are looking for solutions to problems such as the one above or perhaps you want to learn a new algorithmic technique for your next competition, you can visit Thrive. This is our database of member created articles that you may find helpful in your journey to being red-rated.

Read below some of our articles:

USEFUL LINKS

This list of important links are where our competitive programmers like to go. Lots of great knowledge and cool data to find.

SRM RemindersPetr
SRM REMINDERS
Never Miss a Topcoder Single Round Match (SRM)! Sign Up For Reminders Today.