Dãy nghịch thế

View as PDF

Submit solution


Points: 0.08 (partial)
Time limit: 1.0s
Memory limit: 512M
Input: stdin
Output: stdout

Problem source:
IOICamp Marathon 2005-2006
Problem type
Allowed languages
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Cho một dãy số ~a_{1}~.. ~a_{N}~. Một nghịch thế là một cặp số ~u~, ~v~ sao cho ~u < v~ và ~a_{u} > a_{v}~. Nhiệm vụ của bạn là đếm số nghịch thế.

Input

  • Dòng đầu ghi số nguyên dương ~N~.
  • ~N~ dòng sau mỗi dòng ghi một số ~a_{i}~ (~1 \leq i \leq N~).
  • ~1 \leq N \leq 60000~
  • ~1 \leq a_{i} \leq 60000~

Output

  • Ghi trên một dòng số ~M~ duy nhất là số nghịch thế.

Sample Input

3
3
1
2

Sample Output

2

Comments

Please read the guidelines before commenting.



  • -11
    Myee  commented on Feb. 7, 2023, 4:18 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • 53
    giorzang  commented on Nov. 30, 2021, 2:14 p.m. edit 2

    Minh lo comment nham loi giai ma k biet delete o dau :v xin phep edit binh luan a