MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | TLE
Submitted:2015-05-09 15:51:00

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 <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <string>
#include <cstdio>
#pragma warning(disable:4996)
#define ull unsigned long long 
#define ll long long
#define sqrt(x) sqrt(abs(x))
#define rep(i,n) for (int i=0; i<(n); i++)
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define RFOR(i,b,a) for (int i=(b)-1; i>=(a); i--)
using namespace std;
ll min(ll a, ll b) { if (a < b) return a; else return b; }
#define N 100010
using namespace std;
int n, m, a[N], b[N], w[N], p[17];
ll ans;
ll work() {
    int pos = 0;
    ll sum = 0;
    rep(j, n) b[j] = a[j];
    rep(i, m) {
        int t = pos;
        FOR(j, t, n) if (b[j] == w[i]) sum += j - pos++;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX