QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#69632#5242. Płótno [B]sysia5 669ms37488kbC++204.5kb2022-12-29 03:04:572022-12-29 03:04:58

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-29 03:04:58]
  • 评测
  • 测评结果:5
  • 用时:669ms
  • 内存:37488kb
  • [2022-12-29 03:04:57]
  • 提交

answer

//Sylwia Sapkowska
#include <bits/stdc++.h>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef DEBUG
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long
typedef pair<int, int> T;
const int oo = 1e18, oo2 = 1e9+7, K = 11;
const int mod = 998244353;

struct Tree{
    vector<vector<T>>tab;
    vector<int>lazy;
    int size = 1;

    Tree(int n){
        while (size < n) size *= 2;
        tab.assign(2*size, vector<T>(K, {oo2, 0}));
        lazy.assign(2*size, 0);
    }

    void init(int x, int lx, int rx, int l, int r){
        if (lx > r || rx < l) return;
        if (lx == rx) {
            tab[x][0] = {0, 1};
            return;
        }
        int m = (lx+rx)/2;
        init(2*x, lx, m, l, r);
        init(2*x+1, m+1, rx, l, r);
        merge(x);
    }

    void merge(int x){
        vector<T>curr;
        int l = 0, r = 0;
        for (int i = 0; i<K; i++){
            if (tab[2*x][l].first == tab[2*x+1][r].first){
                curr.emplace_back(tab[2*x][l].first, tab[2*x][l].second + tab[2*x+1][r].second);
                l++;r++;
            } else if (tab[2*x][l].first < tab[2*x+1][r].first) curr.emplace_back(tab[2*x][l++]);
            else curr.emplace_back(tab[2*x+1][r++]);
        }
        tab[x] = curr;
    }

    void add(int x, int b){
        lazy[x] += b;
        for (int i = 0; i<K; i++) {
            tab[x][i].first += b;
        }
    }

    void update(int x, int lx, int rx, int l, int r, int v){
        if (lx > r || rx < l) return;
        if (lx >= l && rx <= r){
            add(x, v);
            return;
        }
        int m = (lx+rx)/2;
        add(2*x, lazy[x]);
        add(2*x+1, lazy[x]);
        lazy[x] = 0;
        update(2*x, lx, m, l, r, v);
        update(2*x+1, m+1, rx, l, r, v);
        merge(x);
    }
};

struct sweep{
    int l, r, add;
    sweep(){}
    sweep(int _l, int _r, int _add){l = _l, r = _r, add = _add;}
};

void solve(){
    int n, k; cin >> n >> k;
    vector a(2, vector<int>(n));
    for (int rep = 0; rep < 2; rep++){
        for (int i = 0; i < n; i++){
            cin >> a[rep][i];
        }
    }
    vector<vector<sweep>>curr(2*n+2);
    auto add = [&](int a, int b, int c, int d){
        if (a <= b && c <= d){
            curr[a].emplace_back(c, d, 1);
            curr[b+1].emplace_back(c, d, -1);
        }
    };
    auto add_rect = [&](vector<int>A, vector<int>B){
        int mn = *min_element(A.begin(), A.end());
        int mx = *max_element(A.begin(), A.end());
        int ymn = 1, ymx = 2*n;
        for (auto x: B){ // forbidden
            if (mn <= x && x <= mx) return;
            if (x <= mn) ymn = max(ymn, x+1);
            if (x >= mx) ymx = min(ymx, x-1);
        }
        add(ymn, mn, mx, ymx);
    };
    for (int i = 0; i < n; i++){
        int j = (i == 0 ? n-1 : i-1);
        add_rect({a[0][i]}, {a[1][i], a[0][j]});
        add_rect({a[1][i]}, {a[0][i], a[1][j]});
        add_rect({a[0][i], a[1][i]}, {a[0][j], a[1][j]});
    }
    Tree t(2*n+3);
    t.init(1, 0, t.size-1, 1, 2*n);
    vector<int>ans(K);
    for (int i = 1; i<=2*n; i++){
        for (auto [l, r, add]: curr[i]) t.update(1, 0, t.size-1, l, r, add);
        for (int j = 0; j<K; j++){
            if (t.tab[1][j].first <= k){
                ans[t.tab[1][j].first] += t.tab[1][j].second;
            }
        }
        t.update(1, 0, t.size-1, i, i, oo2);
    }
    ans[1] += ans[0];
    for (int i = 1; i<=k; i++) cout << ans[i] << " ";
    cout << "\n";
}

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

詳細信息

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 2ms
memory: 3496kb

input:

10 1
6 18 4 17 1 8 7 13 5 10
2 20 3 11 15 12 19 16 14 9

output:

58 

result:

ok single line: '58 '

Test #2:

score: 0
Accepted
time: 2ms
memory: 3532kb

input:

50 1
23 16 49 25 71 84 82 43 70 61 75 92 24 78 48 66 100 9 81 44 91 22 7 51 37 33 10 41 62 26 55 32 47 54 3 31 40 68 8 77 73 59 96 38 50 97 46 99 60 42
45 53 88 27 79 39 63 29 89 58 15 36 64 18 93 76 98 65 11 87 95 67 21 6 80 28 83 74 5 72 13 20 52 17 85 56 4 94 57 86 12 35 90 69 2 34 14 1 30 19

output:

136 

result:

ok single line: '136 '

Test #3:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

100 1
195 19 174 197 7 116 192 87 159 3 90 93 148 47 125 151 30 181 84 5 166 161 122 127 45 4 144 98 26 171 153 86 138 51 124 194 101 52 49 11 58 172 139 176 160 14 33 28 63 146 20 114 102 44 89 25 179 40 60 55 8 48 82 141 175 1 165 61 190 134 105 66 157 97 12 117 32 78 164 76 131 180 35 65 94 96 22...

output:

386 

result:

ok single line: '386 '

Test #4:

score: 0
Accepted
time: 1ms
memory: 3520kb

input:

100 1
183 186 188 190 192 194 195 198 199 1 4 5 7 9 11 13 16 18 19 21 24 25 28 30 31 34 36 38 39 42 43 46 48 50 51 54 55 57 60 61 63 66 67 70 72 74 76 77 80 81 83 86 87 90 92 94 95 98 99 101 103 105 107 109 111 113 116 117 119 121 123 125 127 129 131 133 135 137 140 141 143 146 148 150 151 154 155 1...

output:

20047 

result:

ok single line: '20047 '

Test #5:

score: 0
Accepted
time: 4ms
memory: 3552kb

input:

100 1
85 89 90 96 95 98 97 101 104 105 107 112 111 114 113 118 117 122 124 127 125 132 130 136 134 139 138 142 141 147 146 151 152 154 156 160 159 162 164 168 166 169 172 174 176 179 178 184 181 185 187 190 189 194 193 199 200 1 4 7 8 12 10 14 16 20 17 21 23 26 28 31 32 36 34 40 38 44 43 45 47 52 51...

output:

10706 

result:

ok single line: '10706 '

Test #6:

score: 0
Accepted
time: 4ms
memory: 3612kb

input:

100 1
82 87 86 83 85 100 94 91 93 98 103 107 104 106 105 118 115 116 112 113 126 122 127 128 129 136 135 137 133 139 142 141 149 148 147 160 156 158 151 153 162 163 165 166 164 171 178 173 180 172 183 188 181 184 186 200 198 195 197 194 6 2 1 4 5 14 16 17 13 12 27 26 25 29 28 32 34 38 31 36 42 49 45...

output:

3654 

result:

ok single line: '3654 '

Test #7:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

100 1
188 194 189 195 193 187 196 191 190 183 16 13 15 5 17 11 20 6 14 4 23 40 36 22 30 24 34 25 32 29 55 41 53 46 43 45 57 59 54 52 72 62 79 71 68 80 65 67 74 77 88 83 89 98 82 84 100 96 91 99 107 106 109 102 115 101 105 117 113 110 137 121 128 133 125 129 123 136 122 132 144 143 145 149 156 157 15...

output:

1098 

result:

ok single line: '1098 '

Test #8:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

100 1
53 55 70 62 64 66 68 78 80 72 74 76 81 83 85 87 89 99 91 93 95 97 103 105 107 109 101 119 111 113 115 117 121 123 125 127 129 136 138 140 132 134 144 146 148 150 142 156 158 160 152 154 161 163 165 167 169 173 175 177 179 171 190 182 184 186 188 194 196 198 200 192 6 8 10 2 4 20 12 14 16 18 23...

output:

2899 

result:

ok single line: '2899 '

Test #9:

score: 0
Accepted
time: 3ms
memory: 3548kb

input:

100 1
105 107 109 111 113 115 117 119 125 127 129 131 133 135 137 139 121 123 157 159 141 143 145 147 149 151 153 155 178 180 162 164 166 168 170 172 174 176 182 184 186 188 190 192 194 196 198 200 18 20 2 4 6 8 10 12 14 16 26 28 30 32 34 36 38 40 22 24 51 53 55 57 59 41 43 45 47 49 66 68 70 72 74 7...

output:

1351 

result:

ok single line: '1351 '

Test #10:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

100 1
43 49 46 48 60 67 70 89 72 73 74 78 81 79 83 88 87 62 65 63 18 17 103 102 99 100 94 95 91 114 105 112 107 108 118 115 181 182 178 175 174 183 184 164 166 172 169 167 155 157 160 161 190 187 192 141 145 146 147 149 152 154 140 139 194 196 197 200 120 135 136 129 131 121 127 124 126 9 4 3 8 1 12...

output:

1078 

result:

ok single line: '1078 '

Test #11:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

100 1
199 99 98 74 71 69 70 66 63 86 80 78 75 81 83 35 59 61 62 56 49 51 50 42 44 38 40 47 45 31 17 30 23 24 26 21 20 34 96 93 91 90 87 15 10 8 5 3 2 11 14 119 115 118 138 134 133 131 129 123 124 127 121 149 144 140 143 148 145 106 105 109 114 113 101 104 169 166 163 168 153 155 152 162 157 159 172 ...

output:

1042 

result:

ok single line: '1042 '

Test #12:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

100 1
88 90 89 91 97 99 100 103 104 108 106 110 62 64 61 69 71 67 74 112 116 115 149 148 152 151 134 138 136 140 137 143 142 125 123 128 119 117 121 129 16 13 11 10 7 6 3 2 18 43 42 29 32 39 33 35 40 25 26 28 22 20 46 47 51 50 57 55 54 58 184 183 188 172 167 169 176 173 175 180 174 161 157 153 160 1...

output:

1080 

result:

ok single line: '1080 '

Test #13:

score: 0
Accepted
time: 4ms
memory: 3652kb

input:

99 1
58 140 60 138 62 136 64 134 66 132 68 130 70 128 72 126 74 124 76 122 78 120 80 118 82 116 84 114 86 112 88 110 90 108 92 106 94 104 96 102 98 100 198 2 196 4 194 6 192 8 190 10 188 12 186 14 184 16 182 18 180 20 178 22 176 24 174 26 172 28 170 30 168 32 166 34 164 36 162 38 160 40 158 42 156 4...

output:

495 

result:

ok single line: '495 '

Test #14:

score: 0
Accepted
time: 2ms
memory: 3552kb

input:

100 1
55 145 57 143 59 141 61 139 63 137 65 135 67 133 69 131 71 129 73 127 75 125 77 123 79 121 81 119 83 117 85 115 87 113 89 111 91 109 93 107 95 105 97 103 99 101 1 199 3 197 5 195 7 193 9 191 11 189 13 187 15 185 17 183 19 181 21 179 23 177 25 175 27 173 29 171 31 169 33 167 35 165 37 163 39 16...

output:

500 

result:

ok single line: '500 '

Test #15:

score: 0
Accepted
time: 4ms
memory: 3524kb

input:

100 1
87 90 91 94 95 98 99 102 103 106 107 110 111 114 115 118 119 122 123 126 127 130 131 134 135 138 139 142 143 146 147 150 151 154 155 158 159 162 163 166 167 170 171 174 175 178 179 182 183 186 187 190 191 194 195 198 199 2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 34 35 38 39 42 43 46 47 50 51...

output:

20100 

result:

ok single line: '20100 '

Subtask #2:

score: 1
Accepted

Test #16:

score: 1
Accepted
time: 1ms
memory: 3556kb

input:

2 4
1 2
4 3

output:

10 0 0 0 

result:

ok single line: '10 0 0 0 '

Test #17:

score: 0
Accepted
time: 2ms
memory: 3384kb

input:

2 4
1 4
2 3

output:

10 0 0 0 

result:

ok single line: '10 0 0 0 '

Test #18:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

2 4
1 4
3 2

output:

8 2 0 0 

result:

ok single line: '8 2 0 0 '

Test #19:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

10 10
12 17 9 11 8 6 13 15 20 16
14 19 4 18 2 5 7 1 3 10

output:

54 70 70 14 2 0 0 0 0 0 

result:

ok single line: '54 70 70 14 2 0 0 0 0 0 '

Test #20:

score: 0
Accepted
time: 3ms
memory: 3620kb

input:

50 10
54 43 68 23 49 12 45 71 75 50 74 29 24 15 7 65 78 3 51 10 42 80 58 47 32 39 37 91 88 1 26 63 38 2 67 94 70 60 98 48 13 34 85 5 61 55 11 89 72 40
53 16 82 20 76 17 46 84 36 9 30 8 25 44 93 86 73 6 35 64 14 79 18 81 57 92 56 97 27 100 31 62 69 52 4 96 66 59 19 99 87 41 95 21 83 90 28 77 22 33

output:

124 134 147 166 169 173 179 205 220 225 

result:

ok single line: '124 134 147 166 169 173 179 205 220 225 '

Test #21:

score: 0
Accepted
time: 4ms
memory: 3520kb

input:

100 10
44 99 183 115 55 138 68 181 39 46 152 54 198 120 17 165 83 25 143 133 33 179 100 94 95 197 117 125 6 160 154 147 88 64 75 196 114 1 112 104 61 58 98 31 67 4 9 52 129 89 128 192 12 18 141 5 80 60 8 16 105 118 63 177 157 149 158 132 29 153 178 71 180 97 127 139 59 146 15 30 171 32 13 184 168 24...

output:

365 288 282 284 310 335 319 365 363 350 

result:

ok single line: '365 288 282 284 310 335 319 365 363 350 '

Test #22:

score: 0
Accepted
time: 4ms
memory: 3444kb

input:

100 10
28 30 31 33 35 38 39 42 43 46 47 49 52 54 56 57 59 61 63 66 68 69 72 74 75 78 79 82 84 86 87 89 91 94 96 97 100 101 104 106 107 110 112 114 116 117 120 121 124 125 128 130 132 134 135 137 140 142 144 146 147 149 151 153 155 157 160 161 163 166 168 170 172 173 175 178 180 181 183 186 187 190 1...

output:

20051 49 0 0 0 0 0 0 0 0 

result:

ok single line: '20051 49 0 0 0 0 0 0 0 0 '

Test #23:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

100 10
21 28 26 32 29 33 35 37 39 43 42 45 46 49 52 53 56 58 57 64 62 65 67 69 72 74 75 79 80 82 81 87 88 92 89 96 94 100 99 103 102 108 106 109 110 116 114 119 117 121 122 127 125 130 131 135 133 140 138 143 141 148 147 151 150 154 155 160 158 161 162 166 165 171 172 176 173 178 177 182 184 187 186...

output:

11932 7149 1019 0 0 0 0 0 0 0 

result:

ok single line: '11932 7149 1019 0 0 0 0 0 0 0 '

Test #24:

score: 0
Accepted
time: 4ms
memory: 3456kb

input:

100 10
46 41 43 49 55 52 56 53 59 67 65 70 66 64 75 77 79 76 72 84 83 82 87 81 92 91 97 93 94 101 107 109 108 110 113 115 111 114 116 130 122 121 125 127 136 133 137 134 131 147 150 141 142 145 155 158 152 160 156 167 164 165 170 166 174 171 176 178 173 185 186 183 190 182 200 195 191 194 197 5 3 8 ...

output:

3138 6031 6099 3528 1144 152 8 0 0 0 

result:

ok single line: '3138 6031 6099 3528 1144 152 8 0 0 0 '

Test #25:

score: 0
Accepted
time: 4ms
memory: 3552kb

input:

100 10
65 61 67 66 74 72 73 77 79 76 96 87 95 83 90 86 88 100 84 93 108 107 115 117 110 120 106 101 112 119 133 124 121 131 128 123 134 140 136 130 149 144 156 142 160 146 154 157 147 148 161 175 169 167 171 163 166 168 176 164 189 195 181 184 185 187 197 199 191 183 18 6 1 4 15 7 17 16 19 20 33 30 ...

output:

1241 2654 3675 4026 3529 2557 1470 666 229 50 

result:

ok single line: '1241 2654 3675 4026 3529 2557 1470 666 229 50 '

Test #26:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

100 10
8 10 2 4 6 20 12 14 16 18 28 30 22 24 26 33 35 37 39 31 48 50 42 44 46 51 53 55 57 59 67 69 61 63 65 75 77 79 71 73 82 84 86 88 90 97 99 91 93 95 105 107 109 101 103 115 117 119 111 113 121 123 125 127 129 137 139 131 133 135 150 142 144 146 148 151 153 155 157 159 162 164 166 168 170 171 173...

output:

2933 7258 6758 2770 366 15 0 0 0 0 

result:

ok single line: '2933 7258 6758 2770 366 15 0 0 0 0 '

Test #27:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

100 10
43 49 53 41 55 57 59 45 47 51 79 67 73 75 63 77 61 71 69 65 82 92 90 88 86 84 100 98 94 96 114 120 104 106 110 102 118 108 116 112 127 139 123 125 131 121 137 129 133 135 155 157 141 151 145 147 159 153 143 149 178 162 174 166 172 168 170 164 180 176 187 191 189 193 195 181 183 199 185 197 11...

output:

1077 3122 4969 5163 3741 1623 362 42 1 0 

result:

ok single line: '1077 3122 4969 5163 3741 1623 362 42 1 0 '

Test #28:

score: 0
Accepted
time: 4ms
memory: 3648kb

input:

100 10
182 178 180 176 157 164 162 168 167 169 171 159 53 54 57 61 59 50 52 47 45 32 30 36 43 42 41 37 33 21 22 15 17 13 24 26 28 7 2 4 6 10 11 197 196 193 192 189 187 200 185 137 135 133 134 121 124 123 128 127 144 142 140 146 154 152 156 148 150 118 117 115 110 109 114 94 93 97 100 88 89 92 108 10...

output:

1161 3919 6857 5815 2118 230 0 0 0 0 

result:

ok single line: '1161 3919 6857 5815 2118 230 0 0 0 0 '

Test #29:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

100 10
84 86 71 64 66 67 69 61 57 60 51 56 52 31 33 49 47 45 42 43 39 37 35 89 94 92 187 189 191 192 197 198 195 179 182 181 183 178 175 174 173 151 150 152 137 145 144 142 141 127 130 131 133 135 120 123 124 126 158 161 163 159 166 167 165 153 154 117 20 21 23 11 14 18 16 3 4 10 7 6 29 27 28 112 11...

output:

1174 3176 4987 5240 3597 1547 349 30 0 0 

result:

ok single line: '1174 3176 4987 5240 3597 1547 349 30 0 0 '

Test #30:

score: 0
Accepted
time: 1ms
memory: 3516kb

input:

100 10
192 182 185 186 187 190 177 180 170 172 176 174 164 168 166 157 160 162 141 143 145 147 154 152 153 155 107 109 114 115 112 120 126 122 117 121 130 131 127 134 138 139 137 104 106 102 99 98 92 91 96 90 89 85 82 80 84 78 8 10 3 1 5 25 29 30 23 47 51 54 50 31 34 35 38 39 37 46 43 60 58 62 57 71...

output:

1544 4630 6475 4841 2030 500 76 4 0 0 

result:

ok single line: '1544 4630 6475 4841 2030 500 76 4 0 0 '

Test #31:

score: 0
Accepted
time: 4ms
memory: 3468kb

input:

99 10
99 1 197 3 195 5 193 7 191 9 189 11 187 13 185 15 183 17 181 19 179 21 177 23 175 25 173 27 171 29 169 31 167 33 165 35 163 37 161 39 159 41 157 43 155 45 153 47 151 49 149 51 147 53 145 55 143 57 141 59 139 61 137 63 135 65 133 67 131 69 129 71 127 73 125 75 123 77 121 79 119 81 117 83 115 85...

output:

495 390 386 382 378 374 370 366 362 358 

result:

ok single line: '495 390 386 382 378 374 370 366 362 358 '

Test #32:

score: 0
Accepted
time: 2ms
memory: 3520kb

input:

100 10
30 170 32 168 34 166 36 164 38 162 40 160 42 158 44 156 46 154 48 152 50 150 52 148 54 146 56 144 58 142 60 140 62 138 64 136 66 134 68 132 70 130 72 128 74 126 76 124 78 122 80 120 82 118 84 116 86 114 88 112 90 110 92 108 94 106 96 104 98 102 100 200 2 198 4 196 6 194 8 192 10 190 12 188 14...

output:

500 394 390 386 382 378 374 370 366 362 

result:

ok single line: '500 394 390 386 382 378 374 370 366 362 '

Test #33:

score: 0
Accepted
time: 5ms
memory: 3688kb

input:

100 10
144 145 148 149 152 153 156 157 160 161 164 165 168 169 172 173 176 177 180 181 184 185 188 189 192 193 196 197 200 1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32 33 36 37 40 41 44 45 48 49 52 53 56 57 60 61 64 65 68 69 72 73 76 77 80 81 84 85 88 89 92 93 96 97 100 101 104 105 108 109 112 113 116...

output:

20100 0 0 0 0 0 0 0 0 0 

result:

ok single line: '20100 0 0 0 0 0 0 0 0 0 '

Subtask #3:

score: 1
Accepted

Test #34:

score: 1
Accepted
time: 8ms
memory: 3896kb

input:

500 10
917 838 302 172 930 427 28 597 459 846 477 474 4 764 33 821 250 204 653 309 142 916 795 928 387 956 810 433 973 609 226 556 547 540 860 847 535 147 768 619 448 52 551 131 294 892 423 241 363 117 566 285 702 230 6 624 358 802 672 641 384 639 911 251 823 750 587 865 751 890 604 317 473 606 998 ...

output:

1781 1446 1564 1298 1500 1585 1516 1761 1659 1513 

result:

ok single line: '1781 1446 1564 1298 1500 1585 1516 1761 1659 1513 '

Test #35:

score: 0
Accepted
time: 19ms
memory: 4548kb

input:

800 10
501 301 1042 332 774 1438 229 750 870 1491 761 609 859 1069 624 1199 1566 1600 48 1356 1453 61 558 1469 1024 1266 947 1379 1232 202 1029 834 1468 222 83 1297 665 1574 898 214 549 1068 1162 633 427 879 1134 360 252 1047 1360 540 939 1178 1311 353 595 305 1445 599 374 890 1484 998 948 58 65 177...

output:

2569 1672 1809 1843 2103 2017 2020 2103 2346 2728 

result:

ok single line: '2569 1672 1809 1843 2103 2017 2020 2103 2346 2728 '

Test #36:

score: 0
Accepted
time: 23ms
memory: 4592kb

input:

1000 10
533 824 156 1787 314 921 594 1157 744 225 948 1568 1666 1948 1367 1922 1810 88 1915 1529 1306 1980 590 467 837 35 518 1373 863 137 1974 1841 1557 1082 336 71 1330 189 565 1162 1780 1295 1112 804 1999 1160 729 899 107 477 1718 401 1548 1412 1956 964 226 739 393 1155 540 1104 335 642 1674 1657...

output:

4097 2479 2501 2703 2532 2700 2566 2584 2614 2622 

result:

ok single line: '4097 2479 2501 2703 2532 2700 2566 2584 2614 2622 '

Test #37:

score: 0
Accepted
time: 23ms
memory: 4572kb

input:

1000 10
586 588 589 592 594 596 598 599 601 604 606 607 609 611 614 615 617 620 621 623 625 627 630 631 634 635 637 639 642 644 645 648 649 652 653 656 658 660 661 664 666 668 670 671 674 676 677 679 681 683 686 688 690 691 693 696 697 700 702 704 705 707 710 712 713 715 717 720 721 724 725 728 729 ...

output:

2000494 506 0 0 0 0 0 0 0 0 

result:

ok single line: '2000494 506 0 0 0 0 0 0 0 0 '

Test #38:

score: 0
Accepted
time: 20ms
memory: 4524kb

input:

1000 10
1523 1526 1525 1530 1529 1533 1535 1538 1539 1544 1541 1547 1546 1550 1551 1554 1553 1558 1559 1563 1561 1566 1565 1572 1569 1576 1575 1580 1577 1584 1583 1587 1588 1589 1590 1595 1596 1597 1598 1603 1601 1607 1608 1612 1611 1613 1615 1619 1617 1621 1622 1628 1626 1632 1629 1635 1636 1637 16...

output:

1181009 712660 107313 18 0 0 0 0 0 0 

result:

ok single line: '1181009 712660 107313 18 0 0 0 0 0 0 '

Test #39:

score: 0
Accepted
time: 21ms
memory: 4504kb

input:

1000 10
1252 1258 1256 1255 1261 1265 1266 1270 1263 1275 1279 1271 1280 1273 1283 1287 1284 1282 1290 1295 1291 1294 1300 1293 1304 1309 1306 1310 1301 1315 1319 1318 1316 1320 1329 1323 1325 1327 1322 1336 1338 1331 1337 1335 1350 1349 1342 1346 1341 1354 1358 1355 1353 1352 1365 1364 1366 1361 13...

output:

285812 632880 616696 333633 107599 21422 2730 220 8 0 

result:

ok single line: '285812 632880 616696 333633 107599 21422 2730 220 8 0 '

Test #40:

score: 0
Accepted
time: 21ms
memory: 4596kb

input:

1000 10
932 930 936 921 937 927 944 958 948 957 956 951 942 943 946 959 969 973 978 967 965 961 962 966 977 974 996 988 984 994 993 997 982 995 987 998 1012 1013 1007 1019 1006 1008 1018 1020 1004 1016 1032 1025 1024 1037 1027 1031 1040 1035 1036 1039 1051 1053 1058 1044 1050 1047 1060 1056 1048 104...

output:

92789 173192 268596 363760 366156 306700 222602 129693 55470 17122 

result:

ok single line: '92789 173192 268596 363760 366...6700 222602 129693 55470 17122 '

Test #41:

score: 0
Accepted
time: 21ms
memory: 4676kb

input:

992 10
4 42 12 53 56 35 40 29 22 52 48 15 61 47 59 23 10 58 3 18 8 11 41 43 7 34 54 25 119 81 95 73 124 72 74 118 112 92 116 80 83 102 90 98 121 70 69 66 110 88 106 99 115 117 100 111 97 86 108 183 168 169 139 141 134 167 146 148 145 182 172 177 166 131 170 174 171 144 142 176 159 140 125 149 147 15...

output:

28144 32800 41988 47901 52909 66176 75605 90646 108403 125518 

result:

ok single line: '28144 32800 41988 47901 52909 66176 75605 90646 108403 125518 '

Test #42:

score: 0
Accepted
time: 17ms
memory: 4676kb

input:

1000 10
789 781 783 794 796 798 800 792 803 805 807 809 801 814 816 818 820 812 823 825 827 829 821 838 840 832 834 836 843 845 847 849 841 854 856 858 860 852 862 864 866 868 870 875 877 879 871 873 881 883 885 887 889 891 893 895 897 899 905 907 909 901 903 920 912 914 916 918 929 921 923 925 927 ...

output:

238584 632984 678116 356244 87426 7475 171 0 0 0 

result:

ok single line: '238584 632984 678116 356244 87426 7475 171 0 0 0 '

Test #43:

score: 0
Accepted
time: 22ms
memory: 4420kb

input:

992 10
1090 1116 1104 1110 1078 1094 1092 1088 1114 1062 1142 1134 1176 1148 1140 1162 1130 1168 1122 1166 1124 1132 1174 1126 1150 1178 1144 1138 1118 1164 1146 1154 1160 1158 1120 1156 1128 1152 1172 1170 1136 1234 1218 1208 1194 1192 1228 1206 1232 1198 1210 1224 1216 1202 1188 1180 1214 1184 120...

output:

31767 59120 94505 137345 195677 243286 258910 247577 223028 192422 

result:

ok single line: '31767 59120 94505 137345 19567...86 258910 247577 223028 192422 '

Test #44:

score: 0
Accepted
time: 21ms
memory: 4600kb

input:

1000 10
1323 1321 1326 1325 1320 1336 1331 1333 1338 1337 1310 1312 1308 1301 1304 1306 1450 1453 1451 1470 1468 1465 1471 1456 1455 1459 1461 1464 1477 1478 1475 1474 1533 1530 1531 1527 1499 1501 1498 1495 1494 1489 1491 1487 1507 1509 1506 1505 1513 1512 1482 1483 1485 1518 1517 1526 1525 1520 15...

output:

12781 51065 138473 283918 418222 429889 328483 191658 91784 37732 

result:

ok single line: '12781 51065 138473 283918 4182...9889 328483 191658 91784 37732 '

Test #45:

score: 0
Accepted
time: 17ms
memory: 4552kb

input:

1000 10
259 247 248 252 256 253 258 84 80 82 8 6 3 15 11 10 9 20 17 54 53 57 58 48 51 47 44 46 38 37 41 35 34 27 28 25 22 21 32 61 71 70 66 68 63 73 75 78 2 1922 1916 1913 1914 1911 1919 1951 1950 1954 1962 1960 1956 1957 1963 1967 1968 1946 1945 1937 1939 1943 1940 1933 1932 1935 1930 1929 1925 192...

output:

13080 60740 185591 363223 468752 426565 283206 137098 48232 11978 

result:

ok single line: '13080 60740 185591 363223 4687...6565 283206 137098 48232 11978 '

Test #46:

score: 0
Accepted
time: 21ms
memory: 4440kb

input:

1000 10
1979 1980 1977 1973 1974 1992 1990 1989 1985 1983 1987 1988 1147 1142 1143 1150 1146 1140 1135 1136 1133 1118 1123 1116 1120 1121 1127 1128 1130 1125 1113 1112 1108 1111 1094 1090 1088 1087 1105 1101 1104 1100 1097 1098 1001 1004 1007 1003 997 999 1041 1039 1037 1042 1028 1030 1026 1032 1025...

output:

11747 52711 161689 338407 469296 444061 301509 149692 54252 14295 

result:

ok single line: '11747 52711 161689 338407 4692...4061 301509 149692 54252 14295 '

Test #47:

score: 0
Accepted
time: 21ms
memory: 4636kb

input:

1000 10
1759 1766 1762 1777 1772 1780 1773 1774 1770 1786 1787 1785 1783 1790 1751 1752 1796 1792 1794 1672 1702 1697 1705 1703 1704 1708 1699 1696 1681 1683 1677 1685 1688 1690 1689 1693 1692 1673 1676 1712 1724 1713 1720 1721 1716 1719 1740 1739 1734 1732 1733 1725 1735 1730 1748 1741 1745 1744 16...

output:

9185 33302 86937 177400 290043 363096 361904 291707 195757 110144 

result:

ok single line: '9185 33302 86937 177400 290043...96 361904 291707 195757 110144 '

Test #48:

score: 0
Accepted
time: 25ms
memory: 4604kb

input:

999 10
300 1698 302 1696 304 1694 306 1692 308 1690 310 1688 312 1686 314 1684 316 1682 318 1680 320 1678 322 1676 324 1674 326 1672 328 1670 330 1668 332 1666 334 1664 336 1662 338 1660 340 1658 342 1656 344 1654 346 1652 348 1650 350 1648 352 1646 354 1644 356 1642 358 1640 360 1638 362 1636 364 1...

output:

4995 3990 3986 3982 3978 3974 3970 3966 3962 3958 

result:

ok single line: '4995 3990 3986 3982 3978 3974 3970 3966 3962 3958 '

Test #49:

score: 0
Accepted
time: 25ms
memory: 4536kb

input:

1000 10
584 1416 586 1414 588 1412 590 1410 592 1408 594 1406 596 1404 598 1402 600 1400 602 1398 604 1396 606 1394 608 1392 610 1390 612 1388 614 1386 616 1384 618 1382 620 1380 622 1378 624 1376 626 1374 628 1372 630 1370 632 1368 634 1366 636 1364 638 1362 640 1360 642 1358 644 1356 646 1354 648 ...

output:

5000 3994 3990 3986 3982 3978 3974 3970 3966 3962 

result:

ok single line: '5000 3994 3990 3986 3982 3978 3974 3970 3966 3962 '

Test #50:

score: 0
Accepted
time: 23ms
memory: 4652kb

input:

1000 10
1316 1317 1320 1321 1324 1325 1328 1329 1332 1333 1336 1337 1340 1341 1344 1345 1348 1349 1352 1353 1356 1357 1360 1361 1364 1365 1368 1369 1372 1373 1376 1377 1380 1381 1384 1385 1388 1389 1392 1393 1396 1397 1400 1401 1404 1405 1408 1409 1412 1413 1416 1417 1420 1421 1424 1425 1428 1429 14...

output:

2001000 0 0 0 0 0 0 0 0 0 

result:

ok single line: '2001000 0 0 0 0 0 0 0 0 0 '

Subtask #4:

score: 0
Time Limit Exceeded

Test #51:

score: 0
Time Limit Exceeded

input:

100000 1
96176 27939 172191 74850 13479 117742 8634 21501 87321 149607 137789 134176 152101 180468 138683 166438 7726 31523 144362 26825 69995 74641 50479 72511 84577 185202 80203 157069 16984 58419 129101 172394 1618 195274 94592 35724 186278 93215 35874 2038 125395 20762 171892 53749 678 174925 13...

output:


result:


Subtask #5:

score: 1
Accepted

Test #61:

score: 1
Accepted
time: 669ms
memory: 36216kb

input:

20000 1
8260 23162 19083 31764 38686 5100 19437 18310 29053 16504 25374 30501 7543 30973 12153 5191 24580 3044 23328 33054 31229 26909 10407 33096 22917 26256 5677 13524 16383 36303 27681 25325 2346 30364 23195 6239 24636 2591 24756 17408 20987 35844 10387 25215 22822 31666 39853 30752 36965 8863 35...

output:

58709 

result:

ok single line: '58709 '

Test #62:

score: 0
Accepted
time: 565ms
memory: 36616kb

input:

20000 1
26639 26637 26642 26644 26645 26647 26649 26652 26655 26653 26660 26657 26661 26663 26667 26665 26670 26669 26673 26676 26677 26680 26681 26683 26685 26688 26692 26691 26696 26693 26697 26699 26703 26702 26708 26707 26709 26711 26713 26715 26719 26717 26724 26722 26728 26725 26730 26729 2673...

output:

449361772 

result:

ok single line: '449361772 '

Test #63:

score: 0
Accepted
time: 544ms
memory: 36256kb

input:

19998 1
31187 31183 31188 31194 31190 31193 31197 31200 31196 31202 31201 31204 31207 31211 31208 31216 31213 31218 31220 31224 31219 31230 31226 31227 31234 31232 31235 31237 31242 31241 31243 31247 31248 31250 31249 31253 31258 31255 31256 31263 31262 31264 31268 31272 31267 31278 31275 31274 3127...

output:

263187864 

result:

ok single line: '263187864 '

Test #64:

score: 0
Accepted
time: 539ms
memory: 36232kb

input:

20000 1
28347 28360 28353 28359 28355 28358 28364 28370 28362 28361 28368 28374 28376 28371 28378 28379 28389 28381 28382 28385 28384 28393 28396 28400 28392 28394 28409 28403 28410 28401 28404 28411 28419 28417 28420 28418 28429 28430 28421 28423 28424 28435 28438 28432 28431 28437 28446 28443 2844...

output:

111679201 

result:

ok single line: '111679201 '

Test #65:

score: 0
Accepted
time: 530ms
memory: 36164kb

input:

20000 1
4209 4215 4219 4221 4201 4232 4238 4210 4229 4227 4205 4226 4244 4272 4246 4263 4278 4279 4245 4275 4277 4253 4255 4254 4274 4252 4266 4249 4259 4268 4262 4250 4297 4319 4299 4308 4285 4289 4316 4287 4290 4304 4320 4305 4281 4317 4309 4314 4315 4312 4311 4306 4352 4346 4333 4328 4354 4359 43...

output:

14538075 

result:

ok single line: '14538075 '

Test #66:

score: 0
Accepted
time: 545ms
memory: 36148kb

input:

19881 1
846 576 825 677 808 672 716 832 601 810 583 781 638 740 813 777 686 749 818 670 724 692 827 809 691 590 824 722 780 823 838 812 651 756 593 719 752 800 621 820 718 776 817 844 736 619 700 647 815 679 714 1054 851 914 1093 906 1023 1095 1036 973 860 961 945 862 864 890 917 897 980 865 1072 10...

output:

1599263 

result:

ok single line: '1599263 '

Test #67:

score: 0
Accepted
time: 563ms
memory: 36412kb

input:

19998 1
14523 14527 14529 14531 14538 14534 14536 14540 14542 14544 14549 14545 14547 14553 14555 14551 14557 14559 14561 14568 14564 14566 14571 14573 14569 14575 14577 14579 14581 14583 14585 14587 14589 14591 14598 14594 14596 14604 14600 14602 14610 14606 14608 14611 14613 14615 14617 14619 1462...

output:

198343066 

result:

ok single line: '198343066 '

Test #68:

score: 0
Accepted
time: 533ms
memory: 35972kb

input:

20000 1
26839 26801 26803 26805 26807 26809 26811 26813 26815 26817 26819 26842 26844 26846 26848 26850 26852 26854 26856 26858 26860 26862 26864 26866 26868 26870 26872 26874 26876 26878 26880 26897 26899 26901 26903 26905 26907 26909 26911 26913 26915 26917 26919 26881 26883 26885 26887 26889 2689...

output:

20074550 

result:

ok single line: '20074550 '

Test #69:

score: 0
Accepted
time: 533ms
memory: 35960kb

input:

19881 1
11766 11768 11770 11772 11774 11776 11778 11780 11782 11784 11786 11788 11790 11792 11794 11796 11798 11800 11802 11804 11806 11808 11810 11812 11814 11816 11818 11820 11822 11824 11826 11828 11830 11832 11834 11836 11838 11840 11842 11844 11564 11566 11568 11570 11572 11574 11576 11578 1158...

output:

3621404 

result:

ok single line: '3621404 '

Test #70:

score: 0
Accepted
time: 544ms
memory: 36312kb

input:

20000 1
39574 39573 39595 39600 39597 39558 39555 39560 39559 39554 39547 39543 39545 39546 39551 39522 39519 39518 39523 39524 39538 39532 39530 39527 39534 39536 39542 39539 39502 39499 39503 39513 39516 39512 39508 39510 39506 39468 39464 39467 39469 39473 39471 39487 39498 39496 39494 39489 3949...

output:

241654 

result:

ok single line: '241654 '

Test #71:

score: 0
Accepted
time: 522ms
memory: 36296kb

input:

20000 1
22703 22710 22702 22713 22715 22724 22725 22721 22728 22718 22723 22729 22740 22735 22742 22738 22736 22732 22743 22746 22752 22754 22747 22750 22766 22763 22772 22775 22771 22774 22773 22782 22785 22779 22778 22783 22758 22760 22762 22755 22790 22787 22791 22697 22698 22911 22913 22907 2290...

output:

227673 

result:

ok single line: '227673 '

Test #72:

score: 0
Accepted
time: 521ms
memory: 36280kb

input:

20000 1
25617 25613 25620 25609 25614 25622 25615 25618 25604 25606 25601 25600 25598 26233 26235 26203 26204 26206 26208 26214 26210 26216 26217 26228 26226 26229 26221 26220 26222 26231 26238 26240 26196 26192 26191 26194 26201 26186 26197 26190 26185 26178 26183 26179 26176 26181 26182 26169 2617...

output:

180672 

result:

ok single line: '180672 '

Test #73:

score: 0
Accepted
time: 535ms
memory: 36384kb

input:

20000 1
20708 20721 20724 20704 20709 20711 20716 20713 20717 20694 20695 20703 20723 20697 20718 20714 20706 20707 20570 20575 20571 20567 20573 20574 20554 20544 20546 20533 20562 20552 20549 20534 20540 20538 20563 20558 20559 20557 20536 20537 20542 20421 20450 20422 20433 20429 20454 20456 2041...

output:

141898 

result:

ok single line: '141898 '

Test #74:

score: 0
Accepted
time: 640ms
memory: 36148kb

input:

19999 1
32970 7030 32968 7032 32966 7034 32964 7036 32962 7038 32960 7040 32958 7042 32956 7044 32954 7046 32952 7048 32950 7050 32948 7052 32946 7054 32944 7056 32942 7058 32940 7060 32938 7062 32936 7064 32934 7066 32932 7068 32930 7070 32928 7072 32926 7074 32924 7076 32922 7078 32920 7080 32918 ...

output:

99995 

result:

ok single line: '99995 '

Test #75:

score: 0
Accepted
time: 667ms
memory: 36300kb

input:

20000 1
22737 17265 22735 17267 22733 17269 22731 17271 22729 17273 22727 17275 22725 17277 22723 17279 22721 17281 22719 17283 22717 17285 22715 17287 22713 17289 22711 17291 22709 17293 22707 17295 22705 17297 22703 17299 22701 17301 22699 17303 22697 17305 22695 17307 22693 17309 22691 17311 2268...

output:

100000 

result:

ok single line: '100000 '

Test #76:

score: 0
Accepted
time: 598ms
memory: 37284kb

input:

20000 1
8083 8086 8087 8090 8091 8094 8095 8098 8099 8102 8103 8106 8107 8110 8111 8114 8115 8118 8119 8122 8123 8126 8127 8130 8131 8134 8135 8138 8139 8142 8143 8146 8147 8150 8151 8154 8155 8158 8159 8162 8163 8166 8167 8170 8171 8174 8175 8178 8179 8182 8183 8186 8187 8190 8191 8194 8195 8198 81...

output:

800020000 

result:

ok single line: '800020000 '

Subtask #6:

score: 1
Accepted

Test #77:

score: 1
Accepted
time: 662ms
memory: 36016kb

input:

20000 10
37122 3130 15044 10634 29395 31698 29227 38486 30743 16224 36762 21225 34434 7049 5922 29646 17043 2684 30346 11095 29406 16909 26412 8343 29837 8721 28099 8734 7717 29088 6414 27191 13096 8463 34156 23605 31577 4853 39185 24977 28983 34919 10330 1303 23468 11457 17442 28837 16603 31324 424...

output:

62119 52465 66066 51757 46662 46349 56343 50160 45653 51054 

result:

ok single line: '62119 52465 66066 51757 46662 46349 56343 50160 45653 51054 '

Test #78:

score: 0
Accepted
time: 544ms
memory: 36604kb

input:

20000 10
694 700 698 701 703 708 705 711 712 715 713 719 717 722 721 726 725 731 730 733 736 739 740 741 744 748 747 750 752 755 754 758 760 763 762 767 768 769 771 774 775 779 778 782 783 788 785 791 792 793 795 797 798 803 802 807 805 810 811 815 813 818 820 824 821 828 826 829 832 835 836 837 839...

output:

456983981 295329490 47706033 496 0 0 0 0 0 0 

result:

ok single line: '456983981 295329490 47706033 496 0 0 0 0 0 0 '

Test #79:

score: 0
Accepted
time: 535ms
memory: 36616kb

input:

19998 10
22267 22269 22276 22273 22278 22284 22282 22281 22286 22288 22285 22291 22295 22294 22297 22302 22299 22305 22304 22308 22310 22311 22309 22319 22317 22316 22325 22324 22322 22331 22327 22332 22334 22337 22338 22342 22344 22340 22348 22345 22350 22354 22355 22356 22357 22361 22362 22364 223...

output:

261992010 355993562 156503457 24165199 1205750 28 0 0 0 0 

result:

ok single line: '261992010 355993562 156503457 24165199 1205750 28 0 0 0 0 '

Test #80:

score: 0
Accepted
time: 532ms
memory: 36292kb

input:

20000 10
17531 17532 17536 17548 17547 17542 17545 17541 17554 17553 17560 17559 17556 17570 17563 17562 17568 17567 17579 17573 17580 17577 17575 17590 17585 17584 17581 17589 17598 17600 17594 17591 17599 17610 17602 17607 17605 17601 17615 17619 17613 17620 17612 17628 17621 17630 17623 17627 176...

output:

111528976 243759878 244574912 139867747 48699191 10227559 1272402 86986 2349 0 

result:

ok single line: '111528976 243759878 244574912 ... 10227559 1272402 86986 2349 0 '

Test #81:

score: 0
Accepted
time: 539ms
memory: 36156kb

input:

20000 10
38355 38321 38346 38349 38370 38380 38374 38397 38400 38385 38399 38391 38388 38383 38387 38398 38368 38377 38371 38396 38395 38373 38376 38392 38412 38415 38417 38438 38414 38431 38428 38430 38421 38436 38423 38409 38401 38408 38426 38413 38434 38418 38410 38424 38455 38477 38475 38441 384...

output:

14121329 22335383 29920571 39156321 50160264 64586844 76930851 82907502 81171935 75100873 

result:

ok single line: '14121329 22335383 29920571 391...851 82907502 81171935 75100873 '

Test #82:

score: 0
Accepted
time: 558ms
memory: 36048kb

input:

19881 10
24352 24274 24463 24334 24357 24370 24395 24398 24403 24502 24522 24532 24356 24367 24281 24570 24641 24788 24780 24584 24735 24627 24771 24673 24754 24739 24544 24724 24756 24727 24663 24652 24781 24567 24557 24690 24645 24583 24798 24746 24801 24787 24682 24804 24624 24659 24692 24812 245...

output:

1650057 2094393 2224697 2336563 2440838 2602756 2724701 2875867 2987376 3109198 

result:

ok single line: '1650057 2094393 2224697 233656...724701 2875867 2987376 3109198 '

Test #83:

score: 0
Accepted
time: 572ms
memory: 36432kb

input:

19998 10
5034 5035 5037 5039 5044 5042 5046 5051 5047 5049 5058 5056 5054 5060 5064 5062 5065 5069 5067 5073 5075 5071 5078 5080 5082 5088 5084 5086 5094 5092 5090 5095 5097 5099 5101 5105 5103 5108 5110 5112 5115 5113 5117 5124 5120 5122 5127 5125 5129 5135 5131 5133 5137 5141 5139 5147 5145 5143 5...

output:

197715447 355660972 204209743 39798755 2475053 36 0 0 0 0 

result:

ok single line: '197715447 355660972 204209743 39798755 2475053 36 0 0 0 0 '

Test #84:

score: 0
Accepted
time: 572ms
memory: 35896kb

input:

20000 10
8802 8840 8816 8869 8843 8863 8853 8855 8861 8841 8849 8851 8867 8847 8875 8845 8859 8857 8871 8873 8877 8879 8865 8884 8892 8916 8886 8918 8896 8908 8894 8890 8902 8920 8898 8900 8906 8904 8914 8910 8888 8882 8912 8923 8949 8925 8927 8933 8959 8939 8957 8921 8945 8937 8941 8931 8953 8947 8...

output:

19286506 42737039 75872452 116638968 140695988 137993194 116537785 82403584 44840971 17466208 

result:

ok single line: '19286506 42737039 75872452 116...785 82403584 44840971 17466208 '

Test #85:

score: 0
Accepted
time: 547ms
memory: 36100kb

input:

19881 10
22186 22174 22234 22030 22114 22100 22094 22178 22204 22026 22102 22068 22078 22142 22098 22018 22126 22274 22184 22170 22122 22232 22244 22238 22228 22162 22156 22024 22270 22046 22224 22262 22112 22088 22292 22530 22340 22470 22460 22538 22400 22478 22512 22500 22424 22296 22330 22490 223...

output:

3478592 4519512 5337710 6381637 7037708 7706696 8415918 9269897 10303428 10974986 

result:

ok single line: '3478592 4519512 5337710 638163...5918 9269897 10303428 10974986 '

Test #86:

score: 0
Accepted
time: 545ms
memory: 36312kb

input:

20000 10
23667 23668 23654 23641 23642 23645 23647 23646 23648 23651 23634 23631 23638 23632 23630 23627 23625 23611 23624 23614 23616 23619 23620 23622 23599 23604 23606 23601 23597 23598 23608 23609 23591 23593 23590 23264 23263 23271 23274 23270 23265 23267 23276 23282 23278 23283 23284 23259 233...

output:

245844 1100660 4034708 12511540 31746928 64353677 103694730 134429740 142689435 124367118 

result:

ok single line: '245844 1100660 4034708 1251154... 134429740 142689435 124367118 '

Test #87:

score: 0
Accepted
time: 552ms
memory: 36292kb

input:

20000 10
4966 4968 4967 4898 4897 4890 4887 4891 4892 4885 4893 4881 4902 4900 4909 4905 4914 4911 4906 4904 4959 4954 4960 4956 4962 4948 4951 4952 4935 4945 4936 4941 4946 4943 4916 4932 4928 4926 4929 4925 4920 4923 4919 4924 4825 4822 4824 4821 4820 4830 4832 4846 4839 4836 4843 4838 4835 4848 4...

output:

215172 987707 3559748 10675697 26094340 51917923 84723806 114800810 130190195 124571487 

result:

ok single line: '215172 987707 3559748 10675697... 114800810 130190195 124571487 '

Test #88:

score: 0
Accepted
time: 557ms
memory: 36256kb

input:

20000 10
36246 36234 36227 36233 36231 36226 36229 36224 36219 36228 36220 36256 36265 36262 36268 36271 36257 36269 36263 36270 36295 36284 36289 36294 36281 36297 36282 36287 36279 36291 36273 36277 36275 36412 36410 36391 36394 36395 36401 36399 36393 36404 36384 36383 36387 36385 36408 36406 363...

output:

188325 845440 3200753 10069928 25421934 51200242 83255465 111097392 124325665 119037859 

result:

ok single line: '188325 845440 3200753 10069928... 111097392 124325665 119037859 '

Test #89:

score: 0
Accepted
time: 549ms
memory: 36092kb

input:

20000 10
8675 8667 8740 8729 8731 8732 8733 8753 8730 8745 8752 8739 8742 8738 8751 8756 8776 8755 8777 8759 8775 8771 8758 8762 8760 8768 8778 8784 8782 8788 8787 8786 8785 8658 8662 8661 8657 8659 8656 8469 8496 8479 8482 8503 8504 8497 8471 8484 8480 8502 8493 8495 8498 8494 8475 8490 8478 8489 8...

output:

149982 659643 2449911 7188072 16021957 28134947 41144724 53161987 63119178 70306844 

result:

ok single line: '149982 659643 2449911 7188072 ...724 53161987 63119178 70306844 '

Test #90:

score: 0
Accepted
time: 659ms
memory: 36300kb

input:

19999 10
16414 23584 16416 23582 16418 23580 16420 23578 16422 23576 16424 23574 16426 23572 16428 23570 16430 23568 16432 23566 16434 23564 16436 23562 16438 23560 16440 23558 16442 23556 16444 23554 16446 23552 16448 23550 16450 23548 16452 23546 16454 23544 16456 23542 16458 23540 16460 23538 164...

output:

99995 79990 79986 79982 79978 79974 79970 79966 79962 79958 

result:

ok single line: '99995 79990 79986 79982 79978 79974 79970 79966 79962 79958 '

Test #91:

score: 0
Accepted
time: 660ms
memory: 36168kb

input:

20000 10
13865 26135 13867 26133 13869 26131 13871 26129 13873 26127 13875 26125 13877 26123 13879 26121 13881 26119 13883 26117 13885 26115 13887 26113 13889 26111 13891 26109 13893 26107 13895 26105 13897 26103 13899 26101 13901 26099 13903 26097 13905 26095 13907 26093 13909 26091 13911 26089 139...

output:

100000 79994 79990 79986 79982 79978 79974 79970 79966 79962 

result:

ok single line: '100000 79994 79990 79986 79982 79978 79974 79970 79966 79962 '

Test #92:

score: 0
Accepted
time: 621ms
memory: 37432kb

input:

20000 10
37508 37509 37512 37513 37516 37517 37520 37521 37524 37525 37528 37529 37532 37533 37536 37537 37540 37541 37544 37545 37548 37549 37552 37553 37556 37557 37560 37561 37564 37565 37568 37569 37572 37573 37576 37577 37580 37581 37584 37585 37588 37589 37592 37593 37596 37597 37600 37601 376...

output:

800020000 0 0 0 0 0 0 0 0 0 

result:

ok single line: '800020000 0 0 0 0 0 0 0 0 0 '

Test #93:

score: 0
Accepted
time: 644ms
memory: 37488kb

input:

20000 5
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32 33 36 37 40 41 44 45 48 49 52 53 56 57 60 61 64 65 68 69 72 73 76 77 80 81 84 85 88 89 92 93 96 97 100 101 104 105 108 109 112 113 116 117 120 121 124 125 128 129 132 133 136 137 140 141 144 145 148 149 152 153 156 157 160 161 164 165 168 169 172 17...

output:

399900015 79993 79993 79994 399860011 

result:

ok single line: '399900015 79993 79993 79994 399860011 '

Test #94:

score: 0
Accepted
time: 629ms
memory: 37424kb

input:

20000 8
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32 33 36 37 40 41 44 45 48 49 52 53 56 57 60 61 64 65 68 69 72 73 76 77 80 81 84 85 88 89 92 93 96 97 100 101 104 105 108 109 112 113 116 117 120 121 124 125 128 129 132 133 136 137 140 141 144 145 148 149 152 153 156 157 160 161 164 165 168 169 172 17...

output:

399780046 79987 79987 79987 79987 79987 79988 399740041 

result:

ok single line: '399780046 79987 79987 79987 79987 79987 79988 399740041 '

Test #95:

score: 0
Accepted
time: 620ms
memory: 37424kb

input:

20000 10
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32 33 36 37 40 41 44 45 48 49 52 53 56 57 60 61 64 65 68 69 72 73 76 77 80 81 84 85 88 89 92 93 96 97 100 101 104 105 108 109 112 113 116 117 120 121 124 125 128 129 132 133 136 137 140 141 144 145 148 149 152 153 156 157 160 161 164 165 168 169 172 1...

output:

399700076 79983 79983 79983 79983 79983 79983 79983 79984 399660071 

result:

ok single line: '399700076 79983 79983 79983 79...83 79983 79983 79984 399660071 '

Subtask #7:

score: 0
Time Limit Exceeded

Test #96:

score: 0
Time Limit Exceeded

input:

100000 1
184488 199575 61547 186158 115443 82615 177342 64604 124208 4012 152444 113522 105138 104715 64740 152490 175932 130353 169948 187430 30884 108488 12761 28267 180529 162418 98945 127768 181574 92995 74927 17992 52128 144406 91892 165442 133627 58061 70318 156100 159695 56046 14083 192791 76...

output:


result:


Subtask #8:

score: 0
Time Limit Exceeded

Test #109:

score: 0
Time Limit Exceeded

input:

100000 10
13763 82869 153448 151170 185611 191283 101826 196257 150421 49313 96588 32246 110056 73755 9887 12523 88212 112364 28378 131033 63099 102930 78232 166326 42025 145005 26580 85545 114549 71238 19865 71364 183284 21738 132799 134266 129286 50677 118977 17635 110174 85984 57815 147687 131631...

output:


result:


Subtask #9:

score: 0
Time Limit Exceeded

Test #122:

score: 0
Time Limit Exceeded

input:

100000 1
173206 29172 157020 147149 12220 145352 172784 36710 183091 187710 142752 23844 81586 161419 87210 154300 66402 175548 62953 30212 149421 117646 193418 118516 177795 115642 176042 126287 14433 17937 105013 14605 143898 132929 143591 115108 42509 177469 90041 168554 70665 11736 145789 93906 ...

output:


result:


Subtask #10:

score: 0
Time Limit Exceeded

Test #140:

score: 0
Time Limit Exceeded

input:

100000 10
57693 110342 28705 133926 61784 186038 51305 155569 48140 115185 14169 141018 165711 24907 12001 165455 122449 21315 93989 187573 166405 193098 3306 189403 2421 23963 28619 50447 23589 121975 112280 17930 2499 90579 103377 113266 119659 153038 102862 35946 124741 136376 146205 141476 11481...

output:


result: