Write sort second-level sorting in C ++ class

Source: Internet
Author: User

When I was doing TC, I got stuck in this issue. Later I asked Daniel, you can write it like this.

1 class evenroute {
2 public:
3 struct node {
4 int X;
5 Int y;
6 node (int A = 0, int B = 0): X (A), y (B ){}
7 };
8
9 static bool CMP (const node & C, const node & D) {// Add static
10 if (C. x = D. X) return C. Y <D. Y;
11 return C. x <D. X;
12}
13
14 string isitpossible (vector <int> X, vector <int> Y, int W ){
15 struct node A [1000];
16 int n = 1000;
17 //....
18 sort (A, A + N, CMP );
19 Return "can ";
20}
21 };

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.