Submit | All submissions | Best solutions | Back to list |
VMILI - Military Story |
Military headquarters plan to develop a better protection for a spaceport. They suppose that the spaceport would be best protected if it is surrounded with as many fences as possible and each fence is patrolled by armed guards. The corresponding order was issued and military engineers started to develop a project.
Wishing to be promoted, sergeant Stupid sent soldiers to dig in fence poles before the project was actually ready. Without much thinking, the soldiers put a lot of poles at random. Help the sergeant to decide how to make barbwire fences using the poles so that the number of fences is maximal.
Input
The first line contains an integer 3 ≤ N ≤ 4000, which is the number of the poles. Each of the following N lines contains two integers 0 ≤ x, y ≤ 10000, which are the coordinates of a corresponding pole. No two poles have the same position.
Output
The output should contain a single integer number, which is the maximal possible number of nested fences that can be constructed. Each fence is a closed polygonal line without self-crossing whose vertices are poles. Different fences should not have common points.
Example
Input: 4 100 100 200 100 100 200 300 300 Output: 1
Added by: | Phenomenal |
Date: | 2009-02-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | acm.timus.ru |
hide comments
2021-10-18 11:22:29
Weak testcases. 6 2 2 1 -3 6 -2 2 -1 4 0 3 -2 This test in my code prints 2, my friend's code prints 1. However, ưe got AC :) Last edit: 2021-10-18 11:41:01 |
|
2016-07-24 09:03:55
plz provide me any additional test case. I'm getting wrong answer Last edit: 2022-08-15 20:57:47 |
|
2015-03-05 03:19:42 Archangel
AC in first attempt, I thought I might get TLE, thanks for this problem though, I finally was able to implement this task :) |
|
2014-10-31 01:48:52 Mohd Irtefa
Does this not work with Python 2.7, I always get a time limit exceeded! |
|
2014-07-26 14:38:29 Naman Goyal
Can't understand if the Time Limit is 1s then how did my code get accepted in 1.71s. Is it because judge runs with more than one test case? |
|
2013-12-20 09:16:37 Viktor Fonic
Note that when you have 2 poles left, you can't make a fence |
|
2013-03-20 10:43:24 Monkey D. Luffy
@Phenomenal more test cases please Last edit: 2013-03-20 10:43:44 |
|
2012-01-21 19:28:26 maharaja
can someone provide additional testcases |
|
2011-06-07 02:15:29 Robin Lee
Note to others: "no common points" in this case means no common vertices. Situations where an internal vertex touches an external edge are permissible. |