Magic Triplets

PDF

Submit solution

Points: 10.00 (partial)
Time limit: 2.0s
Memory limit: 256M
Input: stdin
Output: stdout

Problem source:
G4G
Problem type
Allowed languages
C, C++, Java, Pascal, Python, Scratch, TEXT

Cho mảng A gồm N phần tử ~A_1, A_2, ..., A_N~.

Yêu cầu:

Đếm số lượng bộ ba số nguyên ~(i,\ j,\ k)~ thỏa mãn ~i < j < k, A_i < A_j < A_k, ~.

Dữ liệu:

Dòng đầu ghi số nguyên N là số phần tử của mảng A ~(3 \le N \le 100000)~
Dòng tiếp theo ghi N số nguyên ~A_i~ là các phần tử của mảng A. ~(1 \le A_i \le 10^5)~

Kết quả:

Một số nguyên duy nhất là số bộ ba thỏa yêu cầu.

Input:

4
1 2 3 4

Output:

4

Giải thích:

Các bộ ba thỏa yêu cầu: (1,2,3) (1,2,4) (1,3,4) (2,3,4)


Comments

Please read the guidelines before commenting.


There are no comments at the moment.