Submission #34405


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;
  bool fa, fb, fc;
  for( int i=0;i<h;i++ ){
    for( int j=0;j<w;j++ ){
      if( c[i][j]=='o' ){
	int nb = d(i,j);
	fa=fb=fc=false;
	for( int k=1; !fa && !fb && !fc;k++ ){
	  int z = nb / (k*k);
	  fa = z==12;
	  fb = z==16;
	  fc = z==11;
	}
	if( fa ) an++;
	else if( fb ) bn++;
	else if( fc ) 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 930 Byte
Status WA
Exec Time 334 ms
Memory 11776 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 34
WA × 22
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 22 ms 788 KB
00_sample_01.txt AC 21 ms 780 KB
00_sample_02.txt AC 21 ms 764 KB
00_sample_03.txt AC 21 ms 788 KB
00_sample_04.txt AC 21 ms 780 KB
00_sample_05.txt AC 21 ms 764 KB
01_rndsmall_00.txt AC 22 ms 900 KB
01_rndsmall_01.txt WA 22 ms 892 KB
01_rndsmall_02.txt AC 23 ms 908 KB
01_rndsmall_03.txt AC 22 ms 908 KB
01_rndsmall_04.txt AC 22 ms 896 KB
01_rndsmall_05.txt AC 22 ms 912 KB
01_rndsmall_06.txt AC 23 ms 896 KB
01_rndsmall_07.txt AC 22 ms 904 KB
01_rndsmall_08.txt AC 23 ms 900 KB
01_rndsmall_09.txt AC 23 ms 900 KB
01_rndsmall_10.txt AC 22 ms 908 KB
01_rndsmall_11.txt AC 24 ms 972 KB
01_rndsmall_12.txt AC 22 ms 892 KB
01_rndsmall_13.txt AC 22 ms 904 KB
01_rndsmall_14.txt AC 23 ms 912 KB
01_rndsmall_15.txt AC 22 ms 912 KB
01_rndsmall_16.txt AC 21 ms 904 KB
01_rndsmall_17.txt AC 23 ms 788 KB
01_rndsmall_18.txt AC 23 ms 912 KB
01_rndsmall_19.txt AC 24 ms 908 KB
02_rndmax_00.txt WA 114 ms 2304 KB
02_rndmax_01.txt WA 109 ms 2304 KB
02_rndmax_02.txt WA 112 ms 1916 KB
02_rndmax_03.txt WA 109 ms 2184 KB
02_rndmax_04.txt AC 115 ms 2004 KB
02_rndmax_05.txt WA 109 ms 2436 KB
02_rndmax_06.txt RE 332 ms 11776 KB
02_rndmax_07.txt WA 119 ms 6248 KB
02_rndmax_08.txt WA 110 ms 2304 KB
02_rndmax_09.txt WA 104 ms 2252 KB
02_rndmax_10.txt WA 106 ms 2300 KB
02_rndmax_11.txt WA 109 ms 2768 KB
02_rndmax_12.txt WA 116 ms 2304 KB
02_rndmax_13.txt AC 123 ms 8328 KB
02_rndmax_14.txt RE 334 ms 11772 KB
02_rndmax_15.txt WA 110 ms 2172 KB
02_rndmax_16.txt WA 117 ms 3552 KB
02_rndmax_17.txt WA 111 ms 3468 KB
02_rndmax_18.txt WA 110 ms 2812 KB
02_rndmax_19.txt WA 111 ms 2252 KB
03_rnd_00.txt AC 23 ms 784 KB
03_rnd_01.txt AC 41 ms 1660 KB
03_rnd_02.txt AC 40 ms 1016 KB
03_rnd_03.txt WA 44 ms 1664 KB
03_rnd_04.txt WA 47 ms 1408 KB
03_rnd_05.txt WA 26 ms 888 KB
03_rnd_06.txt AC 57 ms 1380 KB
03_rnd_07.txt WA 32 ms 1024 KB
03_rnd_08.txt WA 72 ms 3968 KB
03_rnd_09.txt AC 60 ms 1540 KB
04_empty_00.txt AC 102 ms 1744 KB
05_maxret_00.txt AC 120 ms 1800 KB