QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#56686#3892. Efficiently ElevatedSa3tElSefr#AC ✓65ms23140kbC++231.6kb2022-10-21 01:20:462022-10-21 01:20:46

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-21 01:20:46]
  • 评测
  • 测评结果:AC
  • 用时:65ms
  • 内存:23140kb
  • [2022-10-21 01:20:46]
  • 提交

answer

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 500 + 5;
const int OO = 1e9 + 5;

int h, w, x[N][N];
bool vis[N][N];
priority_queue<pair<int, pair<int, int>>> pq;

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

void flow(int a, int b) {
    vis[a][b] = true;
    for (int i = 0; i < 4; ++i) {
        int newA = a + dx[i];
        int newB = b + dy[i];
        if (newA < h && newA >= 0 && newB < w && newB >= 0 && !vis[newA][newB] && x[newA][newB] <= x[a][b]) {
            flow(newA, newB);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> x[i][j];
            if (x[i][j] > 1) {
                pq.push({x[i][j], {i, j}});
            }
        }
    }
    int answer = 0;
    while (!pq.empty()) {
        auto current_square = pq.top();
        pq.pop();
        auto position = current_square.second;
        if (!vis[position.first][position.second]) {
            flow(position.first, position.second);
            ++answer;
        }
    }
    cout << answer << '\n';
    return 0;
}

詳細信息

Test #1:

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

input:

3 3
1 2 3
0 0 4
7 6 5

output:

1

result:

ok single line: '1'

Test #2:

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

input:

6 7
0 0 0 0 0 0 0
0 1 2 3 2 1 0
0 1 2 3 2 1 0
0 0 0 0 0 0 0
0 1 0 5 0 0 0
0 0 0 0 0 0 0

output:

2

result:

ok single line: '2'

Test #3:

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

input:

4 4
1 1 2 1
2 2 1 2
1 2 2 1
2 1 2 2

output:

4

result:

ok single line: '4'

Test #4:

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

input:

50 25
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 5 0 0 0 0 10 10 0 10 10 0 10 11 0 10 10 0 0 0 0 0 0
0 0 0 4 0 0 0 0 10 0 0 0 10 0 10 0 0 0 11 0 0 0 0 0 0
0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 4 3 0 3 4 5 0 10 0 0 0 10 0 11 0 0 0 10 0 0 0 0 0 0
0 0 0 3 0 0 0 0 10 10 0 10 1...

output:

28

result:

ok single line: '28'

Test #5:

score: 0
Accepted
time: 56ms
memory: 7476kb

input:

500 500
999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 100000000...

output:

125000

result:

ok single line: '125000'

Test #6:

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

input:

15 15
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 ...

output:

112

result:

ok single line: '112'

Test #7:

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

input:

500 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

0

result:

ok single line: '0'

Test #8:

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

input:

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

output:

0

result:

ok single line: '0'

Test #9:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 11ms
memory: 4532kb

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:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 65ms
memory: 22928kb

input:

500 500
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000...

output:

1

result:

ok single line: '1'

Test #12:

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

input:

500 500
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

output:

1

result:

ok single line: '1'

Test #13:

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

input:

1 1
0

output:

0

result:

ok single line: '0'

Test #14:

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

input:

1 1
1

output:

0

result:

ok single line: '0'

Test #15:

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

input:

1 1
1000000000

output:

1

result:

ok single line: '1'

Test #16:

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

input:

10 9
0 0 1 0 2 0 1 0 0
0 0 1 0 2 0 1 0 0
1 1 1 0 2 1 1 1 1
0 0 0 0 2 0 0 0 0
2 2 2 2 2 0 0 0 0
0 0 0 0 3 0 0 0 0
3 4 0 0 3 0 0 0 0
4 3 0 0 3 3 3 3 3
0 0 0 0 0 0 3 0 0
0 0 0 0 0 0 3 0 0

output:

3

result:

ok single line: '3'

Test #17:

score: 0
Accepted
time: 11ms
memory: 5532kb

input:

203 347
916879845 937252694 391022453 89978003 634030332 101731698 199528945 450823909 524744922 774250323 39638192 517746918 830485529 452142636 741348119 555845267 107263418 722556774 795717747 567823766 825040544 169255395 517070719 223142167 923428116 423752899 166792882 158836574 927142878 8235...

output:

14176

result:

ok single line: '14176'

Test #18:

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

input:

205 340
726076542 181100235 920613657 864898375 676032496 496171094 482877205 939574823 762838372 416503168 606104252 378710090 238226335 461877359 942229157 14897166 304137670 506161531 49688420 917414359 506105765 605549799 909318331 964271911 995466513 743286187 446279959 435239713 615755979 9233...

output:

14016

result:

ok single line: '14016'

Test #19:

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

input:

297 255
253839767 967646098 397602969 942498651 529467712 953789754 864204377 754263600 444320 897881492 461791799 74498526 143334763 567761007 182366942 396881807 262116243 983155946 293871931 791570192 386677171 895578474 113311052 352249745 41054946 135884283 724596375 160820600 133021189 2772287...

output:

15142

result:

ok single line: '15142'

Test #20:

score: 0
Accepted
time: 15ms
memory: 5320kb

input:

231 312
520126674 157702860 923320499 660326482 668521669 580244095 951168333 498603330 735803102 430822254 669831190 474558460 906248258 198177524 163812924 101684810 896945102 765867146 856937335 987948886 922866560 998783457 145564692 721026445 820933487 167212611 450519836 19979372 664762039 714...

output:

14428

result:

ok single line: '14428'

Test #21:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #22:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #23:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #24:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #25:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

2

result:

ok single line: '2'

Test #26:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

5

result:

ok single line: '5'

Test #27:

score: 0
Accepted
time: 45ms
memory: 7048kb

input:

500 500
6 6 0 4 8 7 6 4 7 5 9 3 8 2 4 2 1 9 4 8 9 2 4 1 1 10 5 7 8 1 5 6 5 9 10 3 8 7 7 8 4 0 8 0 1 6 10 10 0 9 7 5 3 5 1 3 9 3 3 2 8 7 1 1 5 8 7 1 4 8 4 1 8 5 8 3 9 8 9 4 7 1 9 6 5 9 3 4 2 3 2 0 9 10 4 7 1 1 10 2 2 0 1 8 10 6 8 4 8 3 3 10 9 6 9 4 7 7 10 10 5 1 5 9 1 7 9 10 5 3 3 0 4 1 3 5 2 5 6 0 1...

output:

45595

result:

ok single line: '45595'

Test #28:

score: 0
Accepted
time: 53ms
memory: 7104kb

input:

500 500
2 9 1 4 1 7 7 7 10 6 3 1 7 0 6 6 9 0 7 4 3 9 1 5 0 0 0 10 8 0 6 10 3 6 0 8 3 7 7 8 3 5 3 10 3 7 4 0 6 8 10 1 2 10 4 1 5 8 6 8 10 3 4 4 9 7 8 6 9 0 7 3 6 6 10 2 5 8 10 5 1 7 10 8 1 2 8 6 5 7 0 7 0 4 9 9 9 6 10 2 2 8 3 0 3 8 8 3 6 8 5 9 5 7 4 10 8 9 0 6 8 2 8 8 3 6 0 7 5 9 8 3 8 6 7 5 6 5 0 8 ...

output:

45263

result:

ok single line: '45263'

Test #29:

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

input:

500 500
1 1 0 1 2 1 1 1 1 1 2 0 2 0 1 0 0 2 1 2 2 2 0 1 0 2 0 2 1 1 2 0 1 1 1 2 2 0 2 1 1 2 1 0 2 0 0 2 1 2 2 2 0 2 1 1 0 2 1 2 0 0 2 0 0 0 2 1 0 0 1 2 1 0 1 2 1 2 0 2 1 2 0 2 2 2 1 1 0 2 1 1 2 0 1 0 0 0 0 2 2 1 1 0 0 2 0 0 0 0 2 2 2 1 2 2 1 2 0 0 2 2 1 2 1 1 1 2 2 2 1 0 1 2 0 1 2 2 1 0 0 0 2 1 0 2 ...

output:

31316

result:

ok single line: '31316'

Test #30:

score: 0
Accepted
time: 33ms
memory: 5640kb

input:

500 500
0 2 0 1 0 1 1 1 2 1 0 0 1 0 1 1 2 0 2 1 1 2 0 2 0 1 0 0 0 2 2 0 1 2 0 1 2 0 2 0 1 1 2 0 1 0 2 0 1 1 0 1 2 2 0 0 2 2 1 0 2 1 2 2 2 1 2 2 0 1 1 2 1 2 1 2 0 1 0 2 1 1 2 0 1 2 2 2 2 1 0 1 2 2 0 0 2 1 1 1 2 0 1 0 1 2 2 2 2 1 2 0 0 2 0 0 0 2 2 0 1 2 1 2 1 1 1 2 2 2 2 0 1 2 2 0 2 2 0 1 0 1 1 2 2 0 ...

output:

30852

result:

ok single line: '30852'

Test #31:

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

input:

500 500
3 3 0 2 3 3 2 3 2 1 1 2 1 0 2 1 2 0 0 2 3 0 2 3 2 1 3 3 2 0 0 0 3 0 3 2 1 2 0 1 1 1 1 3 0 0 2 3 0 2 2 0 2 1 2 3 0 3 2 1 2 1 1 1 0 2 3 0 0 1 1 0 0 3 2 1 1 3 2 3 3 2 0 2 0 3 2 1 1 0 2 0 1 2 1 2 3 0 0 1 1 0 0 0 0 1 0 3 0 2 0 0 0 1 1 0 3 1 0 0 3 0 2 0 1 0 2 2 3 1 0 3 0 0 3 1 2 2 3 1 1 0 1 1 2 2 ...

output:

36989

result:

ok single line: '36989'

Test #32:

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

input:

500 500
3 3 0 2 4 3 3 2 3 2 4 1 4 1 2 1 0 4 2 4 4 1 2 0 0 2 3 4 0 2 3 2 4 1 4 3 3 4 2 0 4 0 0 3 0 4 3 2 1 2 0 1 4 1 1 1 4 3 0 0 2 4 3 0 2 4 2 0 4 2 4 1 4 4 4 2 3 0 4 3 2 4 1 2 1 1 1 0 4 2 3 0 0 1 1 0 0 4 3 4 2 4 1 1 4 3 4 2 3 3 2 0 2 4 0 3 4 2 1 1 0 2 0 1 2 1 2 3 0 0 1 1 0 4 4 4 0 0 0 1 4 4 0 3 0 2 ...

output:

39825

result:

ok single line: '39825'

Test #33:

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

input:

500 500
1 0 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 1969 1968 1967 1966 1965 1964 1963 1962 1961 1960 1959 1958 1957 1956 1955 1954 1953 1952 1951 1950 1949 1948 1947 1946 1945 1944 1943 1942 1941 1940 1939 193...

output:

1

result:

ok single line: '1'

Test #34:

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

input:

35 500
1 0 1065 1064 1063 1062 1061 1060 1059 1058 1057 1056 1055 1054 1053 1052 1051 1050 1049 1048 1047 1046 1045 1044 1043 1042 1041 1040 1039 1038 1037 1036 1035 1034 1033 1032 1031 1030 1029 1028 1027 1026 1025 1024 1023 1022 1021 1020 1019 1018 1017 1016 1015 1014 1013 1012 1011 1010 1009 1008...

output:

1

result:

ok single line: '1'

Test #35:

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

input:

500 500
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

output:

1

result:

ok single line: '1'

Test #36:

score: 0
Accepted
time: 31ms
memory: 13728kb

input:

500 500
7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 ...

output:

1

result:

ok single line: '1'