Codeforces Round #313 (Div. 1)

Source: Internet
Author: User

Official English: http://codeforces.com/blog/entry/19237

Problem A:

Main topic:

The six-side lengths (all positive integers) of the inner angle and the hexagon with 120° are given, and the maximum number of positive triangles that can be divided into 1 of the edge length is obtained.

Exercises

Turn the hexagon complement into a positive triangle and subtract the positive triangles of the three corners.

Problem B:

Main topic:

Give two string ab of equal length, define two strings equal if and only if a=b or when the length is even, A[1...N/2]=B[1...N/2] && A[N/2+1...N]=B[N/2+1...N] or

When the length is even, A[1...N/2]=B[N/2+1...N] && A[N/2+1...N]=B[1...N/2]

Exercises

1. At the time of the game, I didn't want to judge directly by definition. Complexity I feel the same as the quick line.  The result was hack. After the game, think of the complexity is still high. F (n) =4*f (N/2) +o (n). F (n) =o (n2)

Since the next two conditions require an even number of lengths, the random data is easily over. The following sets of data can be used to get rid of violence. It's not easy to get stuck with someone else.

BA * 32768ab * 32768

2. Positive solution: The definition of "equality" in the topic is transitive. Therefore, the string with the smallest dictionary order can be calculated separately from the ab "equal" and then judged to be equal.

string Smallest (string s) {    if21return  s;     = Smallest (s.substring (0, s.length ()/2));     = Smallest (S.substring (s.length ()/2), s.length ());     if return s1 + s2;     Else return S2 + s1;}

Problem C:

Main topic:

Given the coordinates of the n*m checkerboard and the K-black lattice, the number of schemes from the upper left corner to the lower right corner without a black lattice is obtained. You can only turn right or down 1 times at a time. k<=3000 n,m<=100000.

Exercises

1. This problem has been done before ... So it was soon recalled. It is possible to subtract from the scheme of the total scheme. F[i] Indicates the number of schemes from the upper left corner that do not go through the black lattice to the first black lattice. Sort the black squares, and then

F[i]= the upper left corner to I of the scheme number-f[j]* (J to I of the scheme number).  The first J lattice is in the upper left of the first lattice. Then ans= the total scheme-f[i]* (I to the lower-right corner of the scheme number).

2. The number of programs from (X1,Y1) to (X2,y2) is C (x2-x1+y2-y1,x2-x1). Pre-processing inverse element just make a mess.

Codeforces Round #313 (Div. 1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.