MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | TLE
Submitted:2015-05-09 15:57:56

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 <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const int N = 200000 + 100, INF = 1000000000 + 100;
int a[N], b[N];
inline int intAbs(const int &x) {
    return x < 0 ? -x : x;
}
int main()
{
    int T;
    scanf("%d", &T);
    for(int ca = 1; ca <= T; ++ca) {
        int n, q;
        scanf("%d%d", &n, &q);
        
        for(int i = 1; i <= n; ++i)
            scanf("%d", &a[i]);
        int L = sqrt(n) + 0.5;
        for(int i = 1; i <= n; ++i)
            b[i] = a[i];
        for(int i = 1; i + L - 1 <= n; i += L)
            sort(b + i, b + i + L);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX