結果

問題 No.697 池の数はいくつか
ユーザー BantakoBantako
提出日時 2018-06-12 20:13:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 641 bytes
コンパイル時間 1,528 ms
コンパイル使用メモリ 163,728 KB
実行使用メモリ 574,924 KB
最終ジャッジ日時 2024-04-25 20:05:46
合計ジャッジ時間 13,660 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 1 ms
6,948 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 2 ms
6,940 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 163 ms
6,940 KB
testcase_25 AC 166 ms
7,480 KB
testcase_26 AC 158 ms
6,944 KB
testcase_27 AC 157 ms
7,032 KB
testcase_28 AC 160 ms
7,532 KB
testcase_29 MLE -
testcase_30 AC 1,439 ms
12,316 KB
testcase_31 MLE -
testcase_32 AC 1,435 ms
12,212 KB
testcase_33 AC 1,406 ms
12,280 KB
testcase_34 AC 1,416 ms
12,276 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 dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};
bool V[3000][3000];
void dfs(int h,int w){
    V[h][w] = 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