QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106857#6373. Impress Herckiseki#AC ✓104ms22952kbC++202.0kb2023-05-19 16:00:002023-05-19 16:00:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-19 16:00:04]
  • 评测
  • 测评结果:AC
  • 用时:104ms
  • 内存:22952kb
  • [2023-05-19 16:00:00]
  • 提交

answer

#include <bits/stdc++.h>
#ifdef CKISEKI
#define safe cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange(#a, a)
using std::cerr;
template <typename ...T>
void debug_(const char *s, T ...a) {
    cerr << "\e[1;32m(" << s << ") = (";
    int cnt = sizeof...(T);
    (..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I>
void orange_(const char *s, I L, I R) {
    cerr << "\e[1;32m[ " << s << " ] = [ ";
    for (int f = 0; L != R; ++L)
        cerr << (f++ ? ", " : "") << *L;
    cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) ((void)0)
#define orange(...) ((void)0)
#endif

#define all(v) begin(v),end(v)

using namespace std;

constexpr int maxc = 1'000'000 + 5;
constexpr int maxn = 500 + 5;

int a[maxn][maxn];

bool exi[maxc];
int x_min[maxc], x_max[maxc];
int y_min[maxc], y_max[maxc];

int cnt[maxc];
int cur[maxc];

int main() {
    cin.tie(nullptr) -> sync_with_stdio(false);
    int n, m; cin >> n >> m;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cin >> a[i][j];

    for (int i = 0; i < maxc; ++i) {
        x_min[i] = n;
        y_min[i] = m;
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            const int c = a[i][j];
            x_min[c] = min(x_min[c], i);
            x_max[c] = max(x_max[c], i);
            y_min[c] = min(y_min[c], j);
            y_max[c] = max(y_max[c], j);
            exi[c] = true;
            cnt[c]++;
        }
    }
    
    int ans = 0;
    for (int c = 0; c < maxc; ++c) {
        if (not exi[c]) continue;
        ans -= 1;
        for (int i = x_min[c]; i <= x_max[c]; ++i) {
            for (int j = y_min[c]; j <= y_max[c]; ++j) {
                if (++cur[a[i][j]] == cnt[a[i][j]]) ans++;
            }
        }
        for (int i = x_min[c]; i <= x_max[c]; ++i) {
            for (int j = y_min[c]; j <= y_max[c]; ++j) {
                --cur[a[i][j]];
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

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

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 17676kb

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: 17692kb

input:

1 3
1 2 3

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

1 3
1 1 3

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

1 3
2 2 2

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

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: 1ms
memory: 17740kb

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: 1ms
memory: 17840kb

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: 3ms
memory: 17696kb

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: 5ms
memory: 15676kb

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: 15832kb

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: 17704kb

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: 3ms
memory: 17808kb

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: 17704kb

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: 15632kb

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: 3ms
memory: 15688kb

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: 0ms
memory: 17872kb

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: 1ms
memory: 17636kb

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: 1ms
memory: 17640kb

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: 15660kb

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: 3ms
memory: 15664kb

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: 1ms
memory: 17828kb

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: 1ms
memory: 17852kb

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: 3ms
memory: 17712kb

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: 2ms
memory: 17716kb

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: 2ms
memory: 17708kb

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: 15652kb

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: 0ms
memory: 17688kb

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: 17692kb

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: 3ms
memory: 17716kb

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: 17880kb

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: 2ms
memory: 17640kb

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: 17692kb

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: 2ms
memory: 17712kb

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: 1ms
memory: 17884kb

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: 1ms
memory: 17856kb

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: 17716kb

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: 17748kb

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: 1ms
memory: 17900kb

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: 2ms
memory: 17764kb

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: 1ms
memory: 17652kb

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: 15684kb

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: 5ms
memory: 17872kb

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: 6ms
memory: 17748kb

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: 0ms
memory: 17588kb

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: 6ms
memory: 17688kb

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: 0ms
memory: 18700kb

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: 2ms
memory: 18628kb

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: 7ms
memory: 18560kb

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: 3ms
memory: 18620kb

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: 2ms
memory: 18316kb

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: 3ms
memory: 16632kb

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: 1ms
memory: 18196kb

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: 0ms
memory: 18760kb

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: 1ms
memory: 16788kb

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: 1ms
memory: 16684kb

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: 1ms
memory: 18680kb

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: 1ms
memory: 17768kb

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: 1ms
memory: 16824kb

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: 0ms
memory: 18196kb

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: 1ms
memory: 18628kb

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: 1ms
memory: 16796kb

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: 4ms
memory: 18792kb

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: 3ms
memory: 16752kb

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: 7ms
memory: 20848kb

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: 5ms
memory: 18796kb

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: 3ms
memory: 18820kb

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: 4ms
memory: 18800kb

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: 9ms
memory: 18152kb

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: 4ms
memory: 18248kb

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: 8ms
memory: 18280kb

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: 2ms
memory: 18520kb

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: 4ms
memory: 16648kb

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: 3ms
memory: 17972kb

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: 4ms
memory: 16792kb

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: 4ms
memory: 18700kb

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: 10ms
memory: 19448kb

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: 11ms
memory: 19460kb

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: 7ms
memory: 19104kb

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: 8ms
memory: 21636kb

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: 7ms
memory: 18940kb

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: 7ms
memory: 17536kb

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: 8ms
memory: 18848kb

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: 9ms
memory: 19788kb

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: 9ms
memory: 17460kb

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: 5ms
memory: 21228kb

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: 6ms
memory: 18476kb

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: 9ms
memory: 18652kb

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: 10ms
memory: 21384kb

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: 4ms
memory: 19792kb

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: 9ms
memory: 18724kb

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: 9ms
memory: 21420kb

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: 9ms
memory: 16876kb

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: 5ms
memory: 18728kb

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: 14ms
memory: 16628kb

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: 10ms
memory: 18392kb

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: 19ms
memory: 18876kb

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: 30ms
memory: 22108kb

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: 21ms
memory: 19432kb

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: 17ms
memory: 22896kb

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: 27ms
memory: 21980kb

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: 23ms
memory: 21352kb

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: 24ms
memory: 21380kb

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: 21ms
memory: 22128kb

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: 22ms
memory: 21348kb

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: 28ms
memory: 21784kb

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: 26ms
memory: 22132kb

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: 21ms
memory: 22180kb

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: 16ms
memory: 22084kb

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: 22ms
memory: 22952kb

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: 33ms
memory: 22176kb

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: 18ms
memory: 22368kb

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: 13ms
memory: 21172kb

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: 14ms
memory: 18648kb

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: 17ms
memory: 22864kb

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: 28ms
memory: 18272kb

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: 104ms
memory: 18728kb

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: 57ms
memory: 18256kb

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: 50ms
memory: 17440kb

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"