Submission #34416


Source Code Expand

Copy
#include <iostream>
using namespace std;

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

int di[8] = {-1,-1,-1, 0, 0,  1,1,1};
int dj[8] = {-1, 0, 1, 1,-1, -1,0,1};

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 k=0;k<8;k++ )
    rtn += d( i+di[k], j+dj[k] );
  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);
	for( int k=1,kk=1; kk<1000000 ;k++,kk=k*k ){
	  int z = nb / kk;
	  switch( z ){
	  case 12: an++; break;
	  case 16: bn++; break;
	  case 11: cn++; break;
	  default: continue;
	  }
	}
      }
    }
  }
  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 910 Byte
Status WA
Exec Time 342 ms
Memory 11776 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 27
WA × 29
RE × 2
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 21 ms 768 KB
00_sample_01.txt AC 22 ms 784 KB
00_sample_02.txt AC 21 ms 788 KB
00_sample_03.txt AC 21 ms 732 KB
00_sample_04.txt AC 21 ms 784 KB
00_sample_05.txt AC 19 ms 772 KB
01_rndsmall_00.txt AC 20 ms 904 KB
01_rndsmall_01.txt WA 22 ms 904 KB
01_rndsmall_02.txt AC 23 ms 904 KB
01_rndsmall_03.txt AC 23 ms 904 KB
01_rndsmall_04.txt AC 23 ms 892 KB
01_rndsmall_05.txt AC 23 ms 888 KB
01_rndsmall_06.txt AC 23 ms 896 KB
01_rndsmall_07.txt WA 22 ms 896 KB
01_rndsmall_08.txt AC 22 ms 908 KB
01_rndsmall_09.txt AC 23 ms 904 KB
01_rndsmall_10.txt AC 23 ms 908 KB
01_rndsmall_11.txt WA 22 ms 912 KB
01_rndsmall_12.txt AC 23 ms 904 KB
01_rndsmall_13.txt AC 24 ms 912 KB
01_rndsmall_14.txt AC 23 ms 908 KB
01_rndsmall_15.txt AC 22 ms 896 KB
01_rndsmall_16.txt AC 23 ms 900 KB
01_rndsmall_17.txt AC 22 ms 908 KB
01_rndsmall_18.txt AC 22 ms 896 KB
01_rndsmall_19.txt AC 27 ms 904 KB
02_rndmax_00.txt WA 115 ms 2336 KB
02_rndmax_01.txt WA 138 ms 2296 KB
02_rndmax_02.txt WA 165 ms 1920 KB
02_rndmax_03.txt WA 150 ms 2172 KB
02_rndmax_04.txt WA 162 ms 2004 KB
02_rndmax_05.txt WA 136 ms 2440 KB
02_rndmax_06.txt RE 331 ms 11776 KB
02_rndmax_07.txt WA 121 ms 6136 KB
02_rndmax_08.txt WA 136 ms 2304 KB
02_rndmax_09.txt WA 125 ms 2176 KB
02_rndmax_10.txt WA 126 ms 2300 KB
02_rndmax_11.txt WA 121 ms 2812 KB
02_rndmax_12.txt WA 120 ms 2308 KB
02_rndmax_13.txt WA 127 ms 8452 KB
02_rndmax_14.txt RE 342 ms 11732 KB
02_rndmax_15.txt WA 148 ms 2180 KB
02_rndmax_16.txt WA 127 ms 3452 KB
02_rndmax_17.txt WA 116 ms 3456 KB
02_rndmax_18.txt WA 117 ms 2820 KB
02_rndmax_19.txt WA 131 ms 2404 KB
03_rnd_00.txt AC 25 ms 784 KB
03_rnd_01.txt WA 43 ms 1668 KB
03_rnd_02.txt AC 51 ms 1020 KB
03_rnd_03.txt WA 44 ms 1672 KB
03_rnd_04.txt WA 52 ms 1408 KB
03_rnd_05.txt WA 26 ms 988 KB
03_rnd_06.txt WA 78 ms 1404 KB
03_rnd_07.txt WA 36 ms 1024 KB
03_rnd_08.txt WA 77 ms 3848 KB
03_rnd_09.txt WA 78 ms 1616 KB
04_empty_00.txt AC 105 ms 1796 KB
05_maxret_00.txt AC 217 ms 1796 KB