CF617D.Polyline

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum number of segments this polyline may consist of.

坐标平面上标有三个点。目标是构造一条简单折线(即不自交、也不自触),使其经过所有这三个点。此外,该折线仅能由与坐标轴平行的线段组成。你需要求出满足条件的折线所含线段数的最小值。

输入格式

Each of the three lines of the input contains two integers. The i-th line contains integers x__i and y__i ( - 109 ≤ x__i, y__i ≤ 109) — the coordinates of the i-th point. It is guaranteed that all points are distinct.

输入包含三行,每行包含两个整数。第 ii 行包含整数 xix_i 和 yiy_i(−109≤xi,yi≤109-10^9 \le x_i, y_i \le 10^9),表示第 ii 个点的坐标。保证所有点互不相同。

输出格式

Print a single number — the minimum possible number of segments of the polyline.

输出一个整数——折线的最少线段数。

输入输出样例

  • 输入#1

    1 -1
    1 1
    1 2

    输出#1

    1
  • 输入#2

    -1 -1
    -1 3
    4 3

    输出#2

    2
  • 输入#3

    1 1
    2 3
    3 2

    输出#3

    3

说明/提示

The variant of the polyline in the first sample: The variant of the polyline in the second sample: The variant of the polyline in the third sample:

第一个样例中的折线变体:
第二个样例中的折线变体:
第三个样例中的折线变体:

输入解题思路,AI测评打分。不知道怎么写?

首页