ABCDEF - ABCDEF
You are given a set S of integers between -30000 and 30000 (inclusive).
Find the total number of sextuples that satisfy:
Input
The first line contains integer N (1 ≤ N ≤ 100), the size of a set S.
Elements of S are given in the next N lines, one integer per line. Given numbers will be distinct.
Output
Output the total number of plausible sextuples.
Examples
Input: 1 1 Output: 1 |
Input: 2 2 3 Output: 4 |
Input: 2 -1 1 Output: 24 |
Input: 3 5 7 10 Output: 10 |
hide comments
SudShekhar:
2013-01-17 11:41:40
long long gives TLE ... Got AC after changing it :) |
|
saket diwakar:
2013-01-16 10:44:09
thanx @ Kushagra Jaiswal.....that really helped...:) |
|
Santiago Palacio:
2013-01-03 08:06:47
@robertbean O(N^3log(N^3)) = O(N^3log(N)), not N^4. And for quicksort, you can pretty much trust in the expected time, not worst-case time. |
|
robertbean:
2012-12-29 02:48:39
Got AC. But confused about something. I see lots of people talking about O(N^3 log N), well, I used qsort for two N^3 size arrays, which I think average time is O(N^3 * logN^3) thus is O(N^4logN), and the worst case is O(N^6). Well, didn't expect I can pass with this, but it did got accepted, strange.. Last edit: 2012-12-29 02:58:58 |
|
符号器:
2012-12-27 11:05:43
can ny 1 suggest which sorting tcnq will be used .... here merge sort bound me for size of array and quick sort bound me for time complexity....
|
|
Santiago Palacio:
2012-12-10 08:12:50
Well... i don't know why people is complaining that much about STL. My solution uses only STL and an O(n^3 log(n)) solution and it passed. (further improvement is possible, but STL and a well thinked algorithm is enough).
|
|
Dario Pavlovic:
2012-11-02 12:34:08
im getting a sigsegv on judge(11). can someone help, please? 7981390 |
|
Boopathi Rajaa:
2012-10-22 09:51:03
Finally AC ... O(n^3 log n) |
|
Hossam El-Deen Goodname:
2012-09-11 02:14:31
@Devu
|
|
KJ:
2012-08-16 16:46:53
use sort function in place of qsort.
|
Added by: | Luka Kalinovcic |
Date: | 2009-07-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | own problem |