Submission #34018


Source Code Expand

Copy
#include <iostream>
using namespace std;

int h,w;
char c[1000][1000];

int d(int i,int j ){
  if( i<0 || i>=h ) return 0;
  if( j<0 || j>=w ) return 0;
  if( c[i][j]=='.' ) return 0;

  c[i][j]='.';

  int rtn=1;
  for( int x=i-1;x<=i+1;x++ ){
    for( int y=j-1;y<=j+1;y++ ){
      if( x==i && y==j ) continue;
      rtn += d(x,y);
    }
  }
  return rtn;
}

int main(){

  cin >> h >> w;
  for( int i=0;i<h;i++ )
    for( int j=0;j<w;j++ )
      cin >> c[i][j];

  int an=0, bn=0, cn=0;
  for( int i=0;i<h;i++ ){
    for( int j=0;j<w;j++ ){
      if( c[i][j]=='o' ){
	int nb = d(i,j);
	if( nb%12==0 )
	  an++;
	else if( nb%16==0 )
	  bn++;
	else if( nb%11==0 )
	  cn++;
      }
    }
  }
  cout << an << " " << bn << " " << cn << endl;

  return 0;
}

Submission Info

Submission Time
Task D - アルファベット探し
User tkmhsy
Language C++ (G++ 4.6.4)
Score 0
Code Size 802 Byte
Status WA
Exec Time 983 ms
Memory 11652 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 25
WA × 30
RE × 3
Set Name Test Cases
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rndsmall_00.txt, 01_rndsmall_01.txt, 01_rndsmall_02.txt, 01_rndsmall_03.txt, 01_rndsmall_04.txt, 01_rndsmall_05.txt, 01_rndsmall_06.txt, 01_rndsmall_07.txt, 01_rndsmall_08.txt, 01_rndsmall_09.txt, 01_rndsmall_10.txt, 01_rndsmall_11.txt, 01_rndsmall_12.txt, 01_rndsmall_13.txt, 01_rndsmall_14.txt, 01_rndsmall_15.txt, 01_rndsmall_16.txt, 01_rndsmall_17.txt, 01_rndsmall_18.txt, 01_rndsmall_19.txt, 02_rndmax_00.txt, 02_rndmax_01.txt, 02_rndmax_02.txt, 02_rndmax_03.txt, 02_rndmax_04.txt, 02_rndmax_05.txt, 02_rndmax_06.txt, 02_rndmax_07.txt, 02_rndmax_08.txt, 02_rndmax_09.txt, 02_rndmax_10.txt, 02_rndmax_11.txt, 02_rndmax_12.txt, 02_rndmax_13.txt, 02_rndmax_14.txt, 02_rndmax_15.txt, 02_rndmax_16.txt, 02_rndmax_17.txt, 02_rndmax_18.txt, 02_rndmax_19.txt, 03_rnd_00.txt, 03_rnd_01.txt, 03_rnd_02.txt, 03_rnd_03.txt, 03_rnd_04.txt, 03_rnd_05.txt, 03_rnd_06.txt, 03_rnd_07.txt, 03_rnd_08.txt, 03_rnd_09.txt, 04_empty_00.txt, 05_maxret_00.txt
Case Name Status Exec Time Memory
00_min.txt AC 20 ms 784 KB
00_sample_01.txt AC 20 ms 784 KB
00_sample_02.txt AC 21 ms 788 KB
00_sample_03.txt AC 21 ms 800 KB
00_sample_04.txt AC 21 ms 820 KB
00_sample_05.txt AC 21 ms 792 KB
01_rndsmall_00.txt WA 22 ms 896 KB
01_rndsmall_01.txt AC 22 ms 1072 KB
01_rndsmall_02.txt AC 23 ms 892 KB
01_rndsmall_03.txt WA 25 ms 920 KB
01_rndsmall_04.txt AC 22 ms 888 KB
01_rndsmall_05.txt AC 24 ms 916 KB
01_rndsmall_06.txt AC 23 ms 892 KB
01_rndsmall_07.txt AC 22 ms 896 KB
01_rndsmall_08.txt AC 23 ms 888 KB
01_rndsmall_09.txt AC 22 ms 856 KB
01_rndsmall_10.txt AC 22 ms 884 KB
01_rndsmall_11.txt WA 22 ms 892 KB
01_rndsmall_12.txt AC 22 ms 896 KB
01_rndsmall_13.txt AC 22 ms 912 KB
01_rndsmall_14.txt AC 22 ms 916 KB
01_rndsmall_15.txt WA 22 ms 916 KB
01_rndsmall_16.txt AC 22 ms 908 KB
01_rndsmall_17.txt AC 22 ms 888 KB
01_rndsmall_18.txt WA 22 ms 896 KB
01_rndsmall_19.txt WA 22 ms 936 KB
02_rndmax_00.txt WA 119 ms 2564 KB
02_rndmax_01.txt WA 118 ms 2420 KB
02_rndmax_02.txt WA 123 ms 1780 KB
02_rndmax_03.txt WA 118 ms 2300 KB
02_rndmax_04.txt WA 121 ms 2048 KB
02_rndmax_05.txt WA 119 ms 2912 KB
02_rndmax_06.txt RE 983 ms 11640 KB
02_rndmax_07.txt WA 131 ms 9084 KB
02_rndmax_08.txt WA 119 ms 2680 KB
02_rndmax_09.txt WA 118 ms 2432 KB
02_rndmax_10.txt WA 116 ms 2556 KB
02_rndmax_11.txt WA 118 ms 3564 KB
02_rndmax_12.txt WA 116 ms 2560 KB
02_rndmax_13.txt RE 356 ms 11652 KB
02_rndmax_14.txt RE 349 ms 11632 KB
02_rndmax_15.txt WA 121 ms 2292 KB
02_rndmax_16.txt WA 123 ms 5376 KB
02_rndmax_17.txt WA 119 ms 4620 KB
02_rndmax_18.txt WA 115 ms 3324 KB
02_rndmax_19.txt WA 121 ms 2548 KB
03_rnd_00.txt AC 23 ms 796 KB
03_rnd_01.txt WA 43 ms 1788 KB
03_rnd_02.txt AC 43 ms 1020 KB
03_rnd_03.txt WA 46 ms 1916 KB
03_rnd_04.txt WA 50 ms 1528 KB
03_rnd_05.txt AC 26 ms 1020 KB
03_rnd_06.txt WA 59 ms 1404 KB
03_rnd_07.txt WA 33 ms 1020 KB
03_rnd_08.txt WA 79 ms 5244 KB
03_rnd_09.txt WA 64 ms 1540 KB
04_empty_00.txt AC 107 ms 1656 KB
05_maxret_00.txt AC 134 ms 1656 KB