結果
問題 | No.697 池の数はいくつか |
ユーザー | lunnear |
提出日時 | 2018-11-22 15:01:08 |
言語 | C++11 (gcc 11.4.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 946 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 55,300 KB |
実行使用メモリ | 600,928 KB |
最終ジャッジ日時 | 2024-05-04 06:18:25 |
合計ジャッジ時間 | 11,897 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | AC | 1 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 2 ms
6,944 KB |
testcase_15 | AC | 2 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,944 KB |
testcase_17 | AC | 1 ms
6,944 KB |
testcase_18 | AC | 2 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 1 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 1 ms
6,944 KB |
testcase_23 | AC | 2 ms
6,940 KB |
testcase_24 | AC | 158 ms
7,044 KB |
testcase_25 | AC | 152 ms
7,116 KB |
testcase_26 | AC | 155 ms
7,080 KB |
testcase_27 | AC | 172 ms
7,040 KB |
testcase_28 | AC | 153 ms
7,084 KB |
testcase_29 | MLE | - |
testcase_30 | AC | 1,368 ms
38,352 KB |
testcase_31 | MLE | - |
testcase_32 | AC | 1,392 ms
38,292 KB |
testcase_33 | AC | 1,375 ms
38,336 KB |
testcase_34 | AC | 1,400 ms
38,300 KB |
ソースコード
#include <iostream> enum State { None = -1, Field, Lake, Lake_Check, }; bool ChechLake(int x, int y, int *s, int h, int w) { if(s[x + y * w] != State::Lake) return false; s[x + y * w] = State::Lake_Check; if(x < (w - 1)) ChechLake(x + 1, y, s, h, w); if(x > 0) ChechLake(x - 1, y, s, h, w); if(y < (h - 1)) ChechLake(x, y + 1, s, h, w); if(y > 0) ChechLake(x, y - 1, s, h, w); return true; } int main() { int h, w; std::cin >> h >> w; int *s = new int[h * w]; for(int i = 0; i < (h * w); i++) { std::cin >> s[i]; } int count = 0; for(int y = 0; y < h; y++) { for(int x = 0; x < w; x++) { if(ChechLake(x, y, s, h, w)) count++; } } std::cout << count << std::endl; delete[] s; return 0; }