結果
問題 | No.697 池の数はいくつか |
ユーザー | lunnear |
提出日時 | 2018-11-22 15:19:41 |
言語 | C++11 (gcc 11.4.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,003 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 56,420 KB |
実行使用メモリ | 433,744 KB |
最終ジャッジ日時 | 2024-05-04 06:20:27 |
合計ジャッジ時間 | 12,332 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,812 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,944 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,940 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 2 ms
6,944 KB |
testcase_19 | AC | 1 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,944 KB |
testcase_22 | AC | 1 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | AC | 162 ms
6,940 KB |
testcase_25 | AC | 156 ms
6,940 KB |
testcase_26 | AC | 154 ms
6,940 KB |
testcase_27 | AC | 152 ms
6,940 KB |
testcase_28 | AC | 151 ms
6,940 KB |
testcase_29 | MLE | - |
testcase_30 | AC | 1,400 ms
11,984 KB |
testcase_31 | MLE | - |
testcase_32 | AC | 1,375 ms
11,944 KB |
testcase_33 | AC | 1,398 ms
11,864 KB |
testcase_34 | AC | 1,399 ms
12,152 KB |
ソースコード
#include <iostream> enum State { None = -1, Field, Lake, Lake_Check, }; int g_w, g_h; char *state; bool ChechLake(short x, short y) { if(state[x + y * g_w] != (char)State::Lake) return false; state[x + y * g_w] = (char)State::Lake_Check; if(x < (g_w - 1)) ChechLake(x + 1, y); if(x > 0) ChechLake(x - 1, y); if(y < (g_h - 1)) ChechLake(x, y + 1); if(y > 0) ChechLake(x, y - 1); return true; } int main() { std::cin >> g_h >> g_w; char *s = new char[g_h * g_w]; state = s; for(int i = 0; i < (g_h * g_w); i++) { int a; std::cin >> a; s[i] = (char)a; } int count = 0; for(short y = 0; y < g_h; y++) { for(short x = 0; x < g_w; x++) { if(ChechLake(x, y)) count++; } } std::cout << count << std::endl; delete[] s; return 0; }