結果

問題 No.697 池の数はいくつか
ユーザー BantakoBantako
提出日時 2018-06-12 20:04:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 641 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 166,972 KB
実行使用メモリ 715,336 KB
最終ジャッジ日時 2024-05-04 05:52:14
合計ジャッジ時間 13,331 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 2 ms
6,944 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 2 ms
6,940 KB
testcase_22 AC 1 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 152 ms
6,940 KB
testcase_25 AC 154 ms
7,112 KB
testcase_26 AC 152 ms
8,024 KB
testcase_27 AC 157 ms
8,032 KB
testcase_28 AC 152 ms
7,560 KB
testcase_29 MLE -
testcase_30 AC 1,361 ms
12,308 KB
testcase_31 MLE -
testcase_32 AC 1,402 ms
12,132 KB
testcase_33 AC 1,382 ms
12,348 KB
testcase_34 AC 1,403 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int H,W;
bool V[3000][3000];
void dfs(int h,int w){
    V[h][w] = 0;
    int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
    rep(i,0,4){
        int x = dx[i] + w, y = dy[i] + h;
        if(x < 0 || x >= W || y < 0 || y >= H)continue;
        if(V[y][x])dfs(y,x);
    }
}
main(){
    cin >> H >> W;
    rep(i,0,H)rep(j,0,W)cin >> V[i][j];
    int cnt = 0;
    rep(i,0,H)rep(j,0,W){
        if(V[i][j]){
            cnt++;
            dfs(i,j);
        }
    }
    cout << cnt << endl;
}
0