QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#112605#6373. Impress Her8BQube#AC ✓570ms22876kbC++142.1kb2023-06-12 15:11:352023-06-12 15:11:38

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-12 15:11:38]
  • 评测
  • 测评结果:AC
  • 用时:570ms
  • 内存:22876kb
  • [2023-06-12 15:11:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define SZ(a) ((int)a.size())

const int MAXC = 1000005;

int arr[505][505], lft[MAXC], rgt[MAXC], up[MAXC], dwn[MAXC];
int cnt[505], adj[505][505], tag[505][505], sum[505], vis[MAXC];

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n, m;
    ll ans = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin >> arr[i][j];
    fill(lft, lft + MAXC, 1000);
    fill(dwn, dwn + MAXC, 1000);
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j) {
            lft[arr[i][j]] = min(lft[arr[i][j]], j);
            rgt[arr[i][j]] = max(rgt[arr[i][j]], j);
            dwn[arr[i][j]] = min(dwn[arr[i][j]], i);
            up[arr[i][j]] = max(up[arr[i][j]], i);
        }

    for (int k = 2; k <= m; ++k)
        for (int i = 1; i <= n; ++i) {
            if (arr[i][k] == arr[i][k - 1] && vis[arr[i][k]] != k) {
                vis[arr[i][k]] = k;
                tag[i][k] = 1;
            }
        }

    memset(vis, 0, sizeof vis);
    for (int d = 1; d <= n; ++d) {
        fill(cnt, cnt + m + 1, 0);
        memset(adj, 0, sizeof adj);
        for (int u = d; u <= n; ++u) {
            vector<int> here;
            for (int k = 1; k <= m; ++k) {
                if (dwn[arr[u][k]] < d) continue;
                if (vis[arr[u][k]] != d && up[arr[u][k]] == u) {
                    vis[arr[u][k]] = d;
                    ++cnt[rgt[arr[u][k]]];
                    if (d == dwn[arr[u][k]]) here.pb(arr[u][k]);
                }
                adj[up[arr[u][k]]][k] += tag[u][k];
            }
            for (int k = 1; k <= m; ++k) {
                adj[u][k] += adj[u - 1][k];
                sum[k] = sum[k - 1] + cnt[k];
            }
            for (int k : here) {
                ans += sum[rgt[k]] - sum[lft[k] - 1] - adj[u][lft[k]] - 1;
            }
        }
    }
    cout << ans << "\n";
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 18860kb

input:

3 4
1 2 2 4
1 1 1 4
5 1 7 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

1 3
1 2 3

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

1 3
1 1 3

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

1 3
2 2 2

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

1 30
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

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

1 30
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 25 27 28 29 30

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

1 30
11 11 11 11 11 11 11 11 11 11 11 11 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 28 28 28

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

1 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

1 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 68 70 71 72 73 74 75 76 76 78 79 80 81 83 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

1 200
1 1 3 4 6 6 7 9 9 10 11 12 13 14 15 16 17 19 19 19 21 22 24 24 26 26 26 28 28 30 31 32 33 34 35 36 36 38 38 40 41 42 43 44 44 46 46 48 49 50 51 53 53 53 55 56 57 58 59 60 60 62 63 63 65 66 67 68 69 70 71 72 73 74 77 77 77 77 79 79 81 82 84 84 84 86 87 88 89 90 92 92 93 95 95 96 97 100 100 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #11:

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

input:

1 200
2 2 2 2 6 6 11 11 11 11 11 11 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 33 33 33 33 33 33 33 33 33 43 43 43 43 43 43 43 43 43 43 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 71 71 71 71 71 71 71 71 71 71 71 85 85 85 85 85 85 85 85 89 89 89 92 92 92 92 92 92 92 92 92 92 ...

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

1 200
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 15...

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

1 200
136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 13...

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

1 200
48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 ...

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

1 200
137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 13...

output:

0

result:

ok 1 number(s): "0"

Test #16:

score: 0
Accepted
time: 6ms
memory: 18816kb

input:

1 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

1 500
1 2 2 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #18:

score: 0
Accepted
time: 8ms
memory: 19736kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #19:

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

input:

1 500
7 7 7 7 7 7 7 9 9 9 11 11 14 14 14 17 17 19 19 19 19 22 23 23 25 26 26 28 29 32 32 32 32 32 32 32 38 38 39 44 44 44 44 44 44 44 44 44 44 44 44 52 52 55 55 55 55 58 58 62 62 62 63 64 65 67 67 67 67 67 67 67 74 74 74 74 74 74 74 74 81 83 83 83 85 86 88 88 88 88 88 88 88 88 88 96 96 96 96 96 101 ...

output:

0

result:

ok 1 number(s): "0"

Test #20:

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

input:

1 500
2 2 2 2 2 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 100 100 100 100 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

1 500
406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 40...

output:

0

result:

ok 1 number(s): "0"

Test #22:

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

input:

1 500
153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 15...

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

1 500
444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 44...

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

3 3
1 2 3
7 5 6
7 8 9

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

3 3
2 2 2
4 5 6
7 7 9

output:

0

result:

ok 1 number(s): "0"

Test #26:

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

input:

3 3
5 5 5
5 5 5
5 5 5

output:

0

result:

ok 1 number(s): "0"

Test #27:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #28:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #29:

score: 0
Accepted
time: 6ms
memory: 18864kb

input:

3 30
31 38 38 38 38 38 38 38 38 38 73 73 73 73 16 16 16 16 19 85 85 85 85 85 85 85 27 85 85 30
31 32 38 38 38 38 38 38 38 40 73 73 73 73 16 16 16 48 80 85 85 85 85 85 85 85 85 85 85 60
62 62 38 38 65 38 38 38 38 70 71 73 73 73 75 76 77 78 80 80 81 82 82 84 85 85 85 89 89 89

output:

10

result:

ok 1 number(s): "10"

Test #30:

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

input:

3 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 52 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #31:

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

input:

3 200
1 2 3 3 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

1

result:

ok 1 number(s): "1"

Test #32:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #33:

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

input:

3 200
1 2 2 2 2 11 11 11 11 11 11 11 11 11 218 218 218 218 218 218 218 218 23 24 427 427 27 427 427 430 430 430 239 239 239 239 239 239 39 39 239 239 239 239 239 248 248 248 248 248 253 253 253 253 253 253 253 253 253 253 253 62 62 266 266 266 266 69 69 69 71 272 73 73 73 277 277 277 277 277 282 282...

output:

37

result:

ok 1 number(s): "37"

Test #34:

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

input:

3 200
284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 284 28...

output:

1

result:

ok 1 number(s): "1"

Test #35:

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

input:

3 200
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

output:

0

result:

ok 1 number(s): "0"

Test #36:

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

input:

3 200
430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 43...

output:

0

result:

ok 1 number(s): "0"

Test #37:

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

input:

3 200
376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 376 37...

output:

0

result:

ok 1 number(s): "0"

Test #38:

score: 0
Accepted
time: 7ms
memory: 18804kb

input:

3 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #39:

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

input:

3 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok 1 number(s): "0"

Test #40:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #41:

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

input:

3 500
1001 2 504 4 505 6 8 8 509 10 11 13 13 514 1017 1017 17 18 19 22 22 22 23 24 28 28 28 28 29 31 31 32 534 534 534 36 37 38 38 540 41 41 543 44 45 46 47 48 49 50 52 52 53 53 53 57 57 57 59 59 61 61 563 64 66 66 1073 1073 1073 1073 1073 72 73 73 75 576 77 77 80 80 82 82 83 83 85 85 87 88 89 88 91...

output:

181

result:

ok 1 number(s): "181"

Test #42:

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

input:

3 500
1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 35 35 35 35 35 35 35 35 35 35 35 35 35 35 41 35 35 35 546 546 55 55 55 55 55 55 55 55 55 55 55 55 59 562 562 562 562 568 568 568 568 68 568 568 71 71 73 575 575 85 ...

output:

84

result:

ok 1 number(s): "84"

Test #43:

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

input:

3 500
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 552 552 552 552 552 552 552 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 60...

output:

5

result:

ok 1 number(s): "5"

Test #44:

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

input:

3 500
297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 29...

output:

0

result:

ok 1 number(s): "0"

Test #45:

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

input:

3 500
1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030 1030...

output:

0

result:

ok 1 number(s): "0"

Test #46:

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

input:

500 3
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 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 10...

output:

0

result:

ok 1 number(s): "0"

Test #47:

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

input:

500 3
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 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 10...

output:

1

result:

ok 1 number(s): "1"

Test #48:

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

input:

500 3
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 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 51
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
73 77 78
73 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 94 96
100 94 99
100 1...

output:

3

result:

ok 1 number(s): "3"

Test #49:

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

input:

500 3
1 2 3
1 1 11
7 11 11
13 11 12
13 17 15
16 17 18
16 16 16
16 23 23
16 26 27
28 29 30
31 41 33
41 41 36
41 41 39
43 41 42
43 41 42
49 47 48
49 50 51
49 53 54
57 57 57
58 57 57
61 62 63
64 65 66
67 71 69
71 71 71
76 74 78
76 76 78
76 76 81
82 83 84
89 89 87
89 89 89
92 92 93
94 95 96
97 100 99
10...

output:

155

result:

ok 1 number(s): "155"

Test #50:

score: 0
Accepted
time: 18ms
memory: 21900kb

input:

500 3
5 5 5
5 5 5
5 5 9
5 5 5
5 5 5
5 5 5
5 5 5
5 5 5
5 5 5
5 5 5
5 5 5
5 5 36
5 5 5
5 5 5
5 5 5
5 5 5
49 5 51
52 5 5
5 5 5
5 5 5
5 5 63
5 5 5
68 68 68
71 71 71
71 71 71
71 71 71
71 71 71
71 71 71
71 71 71
71 71 71
173 173 173
173 173 173
173 173 173
173 173 173
103 173 173
173 173 173
173 173 173
1...

output:

82

result:

ok 1 number(s): "82"

Test #51:

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

input:

500 3
24 24 24
24 24 24
24 24 24
24 24 24
24 24 24
24 24 24
24 24 24
119 24 24
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 119 119
119 1...

output:

13

result:

ok 1 number(s): "13"

Test #52:

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

input:

500 3
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 308 308
308 30...

output:

1

result:

ok 1 number(s): "1"

Test #53:

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

input:

500 3
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 201 201
201 20...

output:

0

result:

ok 1 number(s): "0"

Test #54:

score: 0
Accepted
time: 24ms
memory: 19792kb

input:

500 3
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 359 359
359 35...

output:

0

result:

ok 1 number(s): "0"

Test #55:

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

input:

500 3
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 707 707
707 70...

output:

0

result:

ok 1 number(s): "0"

Test #56:

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

input:

500 3
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 613 613
613 61...

output:

0

result:

ok 1 number(s): "0"

Test #57:

score: 0
Accepted
time: 18ms
memory: 19736kb

input:

500 3
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052 1052
1052 1052...

output:

0

result:

ok 1 number(s): "0"

Test #58:

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

input:

500 3
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 842 842
842 84...

output:

0

result:

ok 1 number(s): "0"

Test #59:

score: 0
Accepted
time: 14ms
memory: 21792kb

input:

500 3
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 398 398
398 39...

output:

0

result:

ok 1 number(s): "0"

Test #60:

score: 0
Accepted
time: 13ms
memory: 19792kb

input:

500 3
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 782 782
782 78...

output:

0

result:

ok 1 number(s): "0"

Test #61:

score: 0
Accepted
time: 32ms
memory: 19828kb

input:

500 30
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100 1...

output:

0

result:

ok 1 number(s): "0"

Test #62:

score: 0
Accepted
time: 41ms
memory: 19856kb

input:

500 30
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100 1...

output:

0

result:

ok 1 number(s): "0"

Test #63:

score: 0
Accepted
time: 40ms
memory: 19856kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #64:

score: 0
Accepted
time: 35ms
memory: 19804kb

input:

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

output:

49

result:

ok 1 number(s): "49"

Test #65:

score: 0
Accepted
time: 38ms
memory: 19828kb

input:

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

output:

442

result:

ok 1 number(s): "442"

Test #66:

score: 0
Accepted
time: 38ms
memory: 19840kb

input:

500 30
1 2 4 4 5 6 7 8 9 10 12 12 13 14 14 46 17 18 19 50 21 22 23 54 54 26 27 28 60 60
31 32 33 34 35 66 37 8 40 40 40 42 43 44 75 46 47 48 50 50 51 52 54 54 55 56 57 58 60 60
61 62 63 64 66 66 66 68 69 70 71 72 73 74 75 76 47 78 79 80 81 82 83 54 85 86 87 88 89 90
91 92 92 94 95 96 97 98 99 102 10...

output:

1074

result:

ok 1 number(s): "1074"

Test #67:

score: 0
Accepted
time: 47ms
memory: 19832kb

input:

500 30
1 32 64 4 5 5 7 38 9 11 11 12 13 14 15 16 17 17 19 22 22 22 25 25 25 26 27 28 29 30
31 32 64 64 5 36 36 38 39 40 42 42 13 44 45 77 47 77 77 50 22 52 53 53 55 26 57 58 59 60
61 61 63 64 65 96 67 68 69 69 71 72 73 74 75 77 77 77 77 80 80 82 53 175 175 86 118 88 119 120
91 93 93 64 95 96 96 68 9...

output:

1681

result:

ok 1 number(s): "1681"

Test #68:

score: 0
Accepted
time: 44ms
memory: 21856kb

input:

500 30
32 32 3 4 5 5 5 9 9 10 11 12 13 14 45 17 17 17 19 19 21 84 23 84 26 26 27 28 29 30
32 32 32 34 5 5 5 9 9 9 41 41 43 44 45 46 17 17 17 80 51 84 84 84 26 86 58 58 29 60
32 32 32 32 5 96 157 68 68 9 71 71 73 74 74 74 17 17 79 80 84 84 84 84 85 86 86 58 58 90
151 122 93 94 156 96 157 157 99 100 1...

output:

2315

result:

ok 1 number(s): "2315"

Test #69:

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

input:

500 30
31 31 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995
31 31 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995 5995
5...

output:

406

result:

ok 1 number(s): "406"

Test #70:

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

input:

500 30
2 2 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034
7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034 7034...

output:

111

result:

ok 1 number(s): "111"

Test #71:

score: 0
Accepted
time: 24ms
memory: 19796kb

input:

500 30
9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977
9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 9977 997...

output:

13

result:

ok 1 number(s): "13"

Test #72:

score: 0
Accepted
time: 26ms
memory: 19756kb

input:

500 30
13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 22 13390 13390 13390 13390 13390 13390 13390 13390
13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13390 13...

output:

1

result:

ok 1 number(s): "1"

Test #73:

score: 0
Accepted
time: 28ms
memory: 19780kb

input:

500 30
4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124
4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 4124 412...

output:

1

result:

ok 1 number(s): "1"

Test #74:

score: 0
Accepted
time: 27ms
memory: 19740kb

input:

500 30
5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888
5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 5888 588...

output:

0

result:

ok 1 number(s): "0"

Test #75:

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

input:

500 30
2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867
2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 2867 286...

output:

0

result:

ok 1 number(s): "0"

Test #76:

score: 0
Accepted
time: 113ms
memory: 20124kb

input:

500 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #77:

score: 0
Accepted
time: 117ms
memory: 20168kb

input:

500 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #78:

score: 0
Accepted
time: 120ms
memory: 20176kb

input:

500 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #79:

score: 0
Accepted
time: 115ms
memory: 20308kb

input:

500 200
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

3

result:

ok 1 number(s): "3"

Test #80:

score: 0
Accepted
time: 130ms
memory: 20176kb

input:

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

output:

76

result:

ok 1 number(s): "76"

Test #81:

score: 0
Accepted
time: 130ms
memory: 20164kb

input:

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

output:

221

result:

ok 1 number(s): "221"

Test #82:

score: 0
Accepted
time: 136ms
memory: 22268kb

input:

500 200
1 2 3 4 205 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 32 32 33 34 35 36 37 38 39 40 41 42 44 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 265 66 67 68 69 70 71 72 73 74 75 76 77 278 79 80 81 82 83 84 86 86 87 88 89 90 91 92 93 94 95 96 297 98 99...

output:

535

result:

ok 1 number(s): "535"

Test #83:

score: 0
Accepted
time: 137ms
memory: 22268kb

input:

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

output:

871

result:

ok 1 number(s): "871"

Test #84:

score: 0
Accepted
time: 183ms
memory: 20480kb

input:

500 200
1 2 3 4 5 6 7 8 9 10 11 12 13 215 215 16 17 218 218 20 21 22 23 24 25 26 27 28 29 30 30 30 33 34 35 36 37 38 39 40 242 42 43 44 246 246 47 48 48 50 52 52 253 253 253 56 57 58 59 59 61 62 62 64 65 66 67 68 69 70 71 272 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 90 90 91 92 93 94 95 97 97...

output:

5764

result:

ok 1 number(s): "5764"

Test #85:

score: 0
Accepted
time: 215ms
memory: 20188kb

input:

500 200
201 201 3 4 5 6 7 8 8 10 11 12 13 13 15 16 17 18 20 20 22 22 22 24 24 26 27 27 29 30 30 32 33 34 35 36 36 38 440 440 41 41 41 244 244 46 247 48 249 50 50 252 53 54 55 56 57 58 59 60 61 62 63 264 65 65 67 68 69 70 71 73 73 74 75 76 77 79 79 80 82 82 82 84 85 86 86 88 90 90 91 92 93 94 96 96 9...

output:

8842

result:

ok 1 number(s): "8842"

Test #86:

score: 0
Accepted
time: 235ms
memory: 20228kb

input:

500 200
1 2 3 4 4 7 7 7 7 10 411 12 13 14 15 416 17 18 19 20 21 22 23 24 25 26 27 29 29 30 231 231 33 33 236 236 37 238 39 39 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 261 61 62 263 464 65 67 67 68 69 270 71 73 73 74 75 75 78 78 79 81 81 481 83 83 85 86 87 286 89 89 92 92 92 94 295 96...

output:

14858

result:

ok 1 number(s): "14858"

Test #87:

score: 0
Accepted
time: 225ms
memory: 20504kb

input:

500 200
1 2 203 608 608 608 608 8 9 10 11 11 13 14 15 416 17 18 18 20 21 21 423 423 26 26 26 28 28 430 31 32 636 636 636 36 37 238 238 40 242 242 244 244 47 47 47 49 49 49 51 52 53 54 255 56 57 58 259 60 61 262 63 64 65 66 67 67 67 271 271 72 273 274 274 276 277 277 79 80 81 283 283 84 85 86 86 88 4...

output:

19374

result:

ok 1 number(s): "19374"

Test #88:

score: 0
Accepted
time: 196ms
memory: 22288kb

input:

500 200
2 2 204 204 204 406 406 406 211 211 11 11 13 14 15 216 216 219 219 219 219 219 25 25 25 25 426 28 231 231 231 32 33 34 231 231 231 231 39 40 1441 1441 1441 245 245 245 245 48 49 50 51 51 1451 1451 1451 57 57 258 258 60 62 62 62 64 267 66 67 72 72 72 72 72 72 72 277 277 277 78 79 79 81 81 83 ...

output:

22704

result:

ok 1 number(s): "22704"

Test #89:

score: 0
Accepted
time: 162ms
memory: 20172kb

input:

500 200
79145 79145 79145 79145 5 5 79145 79145 79145 79145 79145 79145 13 13 15 16 79145 79145 79145 79145 79145 79145 79145 79145 79145 79145 79145 79145 79145 30 79145 79145 79145 79145 79145 36 37 638 638 638 638 638 638 44 79145 79145 79145 79145 79145 79145 79145 79145 257 257 257 257 257 58 5...

output:

9046

result:

ok 1 number(s): "9046"

Test #90:

score: 0
Accepted
time: 93ms
memory: 20236kb

input:

500 200
2 2 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 93120 247 93120 93120 93120 93...

output:

2412

result:

ok 1 number(s): "2412"

Test #91:

score: 0
Accepted
time: 75ms
memory: 20136kb

input:

500 200
1 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 95748 49 49 95...

output:

282

result:

ok 1 number(s): "282"

Test #92:

score: 0
Accepted
time: 73ms
memory: 21944kb

input:

500 200
18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 20 18374 18374 18374 18374 18374 18374 18374 18374 18374 30 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 18374 1837...

output:

36

result:

ok 1 number(s): "36"

Test #93:

score: 0
Accepted
time: 72ms
memory: 19832kb

input:

500 200
88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 88269 8826...

output:

8

result:

ok 1 number(s): "8"

Test #94:

score: 0
Accepted
time: 72ms
memory: 19756kb

input:

500 200
76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 76307 7630...

output:

0

result:

ok 1 number(s): "0"

Test #95:

score: 0
Accepted
time: 73ms
memory: 19748kb

input:

500 200
64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 64425 6442...

output:

0

result:

ok 1 number(s): "0"

Test #96:

score: 0
Accepted
time: 258ms
memory: 20936kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #97:

score: 0
Accepted
time: 244ms
memory: 21452kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #98:

score: 0
Accepted
time: 257ms
memory: 20848kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok 1 number(s): "0"

Test #99:

score: 0
Accepted
time: 260ms
memory: 22812kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

4

result:

ok 1 number(s): "4"

Test #100:

score: 0
Accepted
time: 272ms
memory: 21112kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 92 94 95 96 97 98 99 100 ...

output:

38

result:

ok 1 number(s): "38"

Test #101:

score: 0
Accepted
time: 268ms
memory: 22876kb

input:

500 500
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 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 67 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

97

result:

ok 1 number(s): "97"

Test #102:

score: 0
Accepted
time: 292ms
memory: 22812kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 82 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

193

result:

ok 1 number(s): "193"

Test #103:

score: 0
Accepted
time: 284ms
memory: 21232kb

input:

500 500
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 557 58 59 60 561 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

416

result:

ok 1 number(s): "416"

Test #104:

score: 0
Accepted
time: 333ms
memory: 20764kb

input:

500 500
1 3 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 32 33 34 35 36 37 38 39 40 40 42 43 44 45 46 47 49 49 50 51 52 53 54 55 56 57 558 59 60 61 62 63 65 65 66 67 68 69 70 71 72 73 74 76 76 77 78 80 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 595 96 97 98 99 10...

output:

2949

result:

ok 1 number(s): "2949"

Test #105:

score: 0
Accepted
time: 347ms
memory: 20728kb

input:

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

output:

5139

result:

ok 1 number(s): "5139"

Test #106:

score: 0
Accepted
time: 413ms
memory: 21132kb

input:

500 500
1 3 3 4 5 6 7 8 9 10 11 12 14 14 15 16 17 18 519 20 21 22 23 24 25 26 27 28 29 530 31 32 33 34 35 536 37 38 39 40 41 42 43 44 45 46 47 49 49 50 51 52 53 54 55 56 57 57 59 60 61 562 63 64 65 66 67 67 70 70 71 72 73 74 75 76 77 578 578 80 81 82 83 84 85 86 87 1088 89 90 91 92 93 93 95 96 97 98...

output:

10071

result:

ok 1 number(s): "10071"

Test #107:

score: 0
Accepted
time: 461ms
memory: 21184kb

input:

500 500
1 2 3 4 4 4 7 8 9 510 11 12 13 14 15 16 17 518 19 21 21 522 23 23 25 526 27 28 29 30 531 32 33 34 35 37 37 37 39 40 41 42 43 44 45 46 47 48 49 550 52 52 53 54 55 56 57 58 59 60 61 62 563 64 65 66 67 68 69 70 71 72 73 74 75 76 76 78 79 81 81 81 83 83 85 86 87 88 89 90 91 92 593 94 95 96 97 98...

output:

15559

result:

ok 1 number(s): "15559"

Test #108:

score: 0
Accepted
time: 503ms
memory: 21080kb

input:

500 500
1 2 5 5 5 6 7 8 9 10 11 12 514 14 14 516 517 18 19 20 21 22 23 24 25 27 27 527 29 30 31 32 33 34 35 37 37 38 39 40 40 42 43 44 546 546 47 48 49 50 51 52 54 54 55 57 57 59 59 59 61 63 63 64 65 568 568 568 69 69 71 72 73 74 75 75 77 78 79 80 80 82 83 84 85 86 87 89 89 90 91 92 93 94 95 97 97 9...

output:

21843

result:

ok 1 number(s): "21843"

Test #109:

score: 0
Accepted
time: 570ms
memory: 20968kb

input:

500 500
1 2 3 4 5 6 7 8 510 510 11 11 13 14 14 17 17 18 18 20 21 23 23 24 25 526 27 29 29 29 31 533 533 34 535 535 37 38 539 41 41 42 1042 44 45 46 47 48 51 51 51 51 553 54 55 557 557 58 59 60 61 62 63 64 64 66 68 68 69 70 571 72 73 73 75 76 79 79 79 79 79 79 583 84 85 86 587 587 90 90 90 92 93 94 9...

output:

36606

result:

ok 1 number(s): "36606"

Test #110:

score: 0
Accepted
time: 553ms
memory: 22808kb

input:

500 500
1 2 3 502 505 6 6 9 9 11 11 12 13 14 15 16 17 19 19 19 19 23 23 23 26 26 26 29 29 30 33 33 33 534 535 535 37 37 37 40 42 42 43 544 45 45 49 49 49 50 1553 1553 53 54 55 56 57 59 59 60 60 63 63 64 65 66 66 71 71 71 71 73 73 73 75 76 78 78 80 80 81 82 83 84 85 86 586 88 1090 1090 1090 592 94 94...

output:

49151

result:

ok 1 number(s): "49151"

Test #111:

score: 0
Accepted
time: 404ms
memory: 21160kb

input:

500 500
3502 3502 4 4 3502 2007 2007 8 9 10 511 12 3517 3517 3517 3517 3517 3517 3517 20 21 21 1521 1521 25 25 1026 1026 30 30 32 32 32 34 34 34 34 34 39 40 41 42 1044 1044 1044 1044 1044 48 48 1044 1044 1044 53 1059 1059 1059 1059 1059 1059 61 61 61 13568 64 13568 13568 13568 13568 13568 70 71 72 7...

output:

59839

result:

ok 1 number(s): "59839"

Test #112:

score: 0
Accepted
time: 288ms
memory: 20812kb

input:

500 500
503 503 503 4 9502 506 506 9502 9502 10 511 511 2013 2013 17 17 17 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 34 35 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 176210 17...

output:

16337

result:

ok 1 number(s): "16337"

Test #113:

score: 0
Accepted
time: 201ms
memory: 22820kb

input:

500 500
91159 2 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 13 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159 91159...

output:

5801

result:

ok 1 number(s): "5801"

Test #114:

score: 0
Accepted
time: 174ms
memory: 20988kb

input:

500 500
80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 80369 8036...

output:

681

result:

ok 1 number(s): "681"

Test #115:

score: 0
Accepted
time: 158ms
memory: 20076kb

input:

500 500
221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 221291 22129...

output:

84

result:

ok 1 number(s): "84"

Test #116:

score: 0
Accepted
time: 181ms
memory: 19796kb

input:

500 500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

124750

result:

ok 1 number(s): "124750"

Test #117:

score: 0
Accepted
time: 185ms
memory: 21884kb

input:

500 500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

31375

result:

ok 1 number(s): "31375"

Test #118:

score: 0
Accepted
time: 204ms
memory: 22204kb

input:

500 500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9065050

result:

ok 1 number(s): "9065050"