CF1051G.Distinctification

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

The first line contains a single integer nn ( 1n21051 \le n \le 2 \cdot 10^5 ) — the number of pairs in sequence PP .

Next nn lines contain the elements of PP : ii -th of the next nn lines contains two integers aia_i and bib_i ( 1ai21051 \le a_i \le 2 \cdot 10^5 , 1bin1 \le b_i \le n ). It is guaranteed that all values of bib_i are pairwise distinct.

输入格式

Print nn integers — the ii -th number should be equal to f(Pi)f(P_i) .

输出格式

输入输出样例

  • 输入#1

    5
    1 1
    3 3
    5 5
    4 2
    2 4
    

    输出#1

    0
    0
    0
    -5
    -16
    
  • 输入#2

    4
    2 4
    2 3
    2 2
    1 1
    

    输出#2

    0
    3
    7
    1
    
首页