hiho week 39 register

Ended

Participants:2159

Verdict:Accepted
Score:100 / 100
Submitted:2015-03-31 17:29:01

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <algorithm>
#include <iostream>
#include <cstring>
#include <complex>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
typedef unsigned long long LL;
const int MOD = int(1e9)+7;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1.0); //M_PI;
const int maxn = 2000001;
int n;
LL p[maxn] , t[maxn] , ans;
void merge(int first , int last)
{
    int mid = (first + last) / 2;
    int i1 = 0 , i2 = first , i3 = mid + 1;
    while(i2 <= mid && i3 <= last)
    {
        if(p[i2] > p[i3])
        {
            t[i1 ++] = p[i3 ++];
            ans += mid - i2 + 1;
        }
        else
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX