問題一覧 > 通常問題

No.1623 Making Triangles

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 146
作問者 : null / テスター : gorugo30 sak
お気に入りにしたユーザー ProblemId : 6393 / 自分の提出
問題文最終更新日: 2022-04-25 23:40:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 306 (順位表) の他の問題:

Problem Statement

There are $n$ sticks of each color: red, green, and blue. The lengths of the $i$-th stick of each color are $r_i, g_i, b_i$, respectively.

When making a triangle using the $i$-th red stick, the $j$-th green stick, and the $k$-th blue stick, compute the number of integer tuples $(i, j, k)$ such that a triangle with positive area is formed and $r_i = \max(r_i, g_j, b_k)$ is satisfied.

Constraints

  • $1 \le n \le 2 \times 10^5$
  • $1 \le r_i, g_i, b_i \le 3 \times 10^3$
  • All inputs are integers.
  • Input

    $n$
    $r_1\ r_2\ \dots\ r_n$
    $g_1\ g_2\ \dots\ g_n$
    $b_1\ b_2\ \dots\ b_n$
    

    Output

    Output the answer on one line. End the output with a newline.

    Sample

    Sample 1
    Input
    2
    2 3
    3 2
    1 2
    
    Output
    5
    

    Only $(i, j, k) = (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), (2, 2, 2)$ satisfy the conditions.

    Sample 2
    Input
    5
    123 456 789 987 654
    321 231 1 1 2
    2 3 500 1000 1000
    
    Output
    3
    

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。