1 /* mergesort :) con el contador :) en divide & conquer */
20 #define forn(i, n) for(int i=0;i<int(n);i++)
21 #define foreach(it, c) for(typeof((c).begin()) it = (c).begin();it!=(c).end();++it)
22 #define ALL(x) (x).begin(),(x).end()
23 #define SORT(x) sort(ALL(x))
25 #define VI vector<int>
26 #define VS vector<string>
34 int array
[10011], cant
[10011], c2
[10011], a2
[10011], a1
[10011], c1
[10011];
35 void back(int b
, int e
){
43 if( array
[b
] <= array
[e
] ){
45 swap(array
[b
], array
[e
]);
54 for(i
=b
;i
<=(b
+e
)/2;i
++)a1
[i
-b
] = array
[i
], c1
[i
-b
] = cant
[i
];
56 for(i
=(b
+e
)/2+1;i
<=e
;i
++)a2
[i
-((b
+e
)/2+1)] = array
[i
], c2
[i
-((b
+e
)/2+1)] = cant
[i
];
58 a1
[n1
] = -1; a2
[n2
] = -1;
59 int ind1
= 0, ind2
= 0;
61 for(int h
= 0 ; h
< cn
; h
++ ){
62 if( a1
[ind1
] <= a2
[ind2
] ){
64 caux
[h
] = c2
[ind2
] + ind1
;
79 scanf("%i %i", &n
, &k
);
80 int best
= -1, nodo
= -1;
82 for(j
=0;j
<n
;j
++)scanf("%i", &array
[j
]);
85 for(j
=0;j
<n
;j
++)total
+= cant
[j
];
86 if( total
> best
){ best
= total
, nodo
= i
;}
88 printf("%i\n", nodo
+1);