Just a tip, especially for those who get TLE and RTE
1. A brute force O(n^3) approach can get Accepted (with use of scanf and good memory allocation)
2. Vertices in the input CAN be greater than n (check problem description)
3. You only need to count triangles up to vertex n
10973 - Triangle Counting
Moderator: Board moderators
-
- New poster
- Posts: 11
- Joined: Fri Nov 08, 2013 11:04 pm
Re: 10973 - Triangle Counting
About the first item: make a linked list using new for node allocation you'll get a better time.Hikari9 wrote:Just a tip, especially for those who get TLE and RTE
1. A brute force O(n^3) approach can get Accepted (with use of scanf and good memory allocation)
2. Vertices in the input CAN be greater than n (check problem description)
3. You only need to count triangles up to vertex n