結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 155 ms
15,972 KB
testcase_25 AC 156 ms
14,836 KB
testcase_26 AC 159 ms
14,908 KB
testcase_27 AC 154 ms
16,024 KB
testcase_28 AC 159 ms
16,604 KB
testcase_29 MLE -
testcase_30 AC 1,397 ms
38,736 KB
testcase_31 MLE -
testcase_32 AC 1,378 ms
38,700 KB
testcase_33 AC 1,387 ms
38,632 KB
testcase_34 AC 1,399 ms
38,644 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;
int 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