Submission #34388


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 l=0;l<8;l++ )
    rtn += d( i+di[l], j+dj[l] );
  return rtn;
}

int gcd(int a, int b){
  if( b==0 ) return a;
  return gcd(b,a%b);
}

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);
	bool fa=true, fb=true, fc=false;
	for( int k=1; (fa&&fb) || (fb&&fc) || (fc&&fa);k++ ){
	  int z = nb / (k*k);
	  fa = z%12==0;
	  fb = z%16==0;
	  fc = z%11==0;

	  if( !fa && !fb && !fc )
	    continue;
	}
	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 1069 Byte
Status WA
Exec Time 365 ms
Memory 11788 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 29
WA × 27
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 23 ms 780 KB
00_sample_02.txt AC 22 ms 776 KB
00_sample_03.txt AC 23 ms 788 KB
00_sample_04.txt AC 22 ms 764 KB
00_sample_05.txt AC 22 ms 780 KB
01_rndsmall_00.txt WA 23 ms 900 KB
01_rndsmall_01.txt AC 23 ms 1040 KB
01_rndsmall_02.txt AC 23 ms 856 KB
01_rndsmall_03.txt WA 23 ms 888 KB
01_rndsmall_04.txt AC 24 ms 904 KB
01_rndsmall_05.txt AC 23 ms 896 KB
01_rndsmall_06.txt AC 23 ms 896 KB
01_rndsmall_07.txt AC 23 ms 888 KB
01_rndsmall_08.txt AC 23 ms 856 KB
01_rndsmall_09.txt AC 23 ms 888 KB
01_rndsmall_10.txt AC 23 ms 920 KB
01_rndsmall_11.txt AC 23 ms 920 KB
01_rndsmall_12.txt AC 24 ms 916 KB
01_rndsmall_13.txt AC 23 ms 920 KB
01_rndsmall_14.txt AC 23 ms 924 KB
01_rndsmall_15.txt WA 22 ms 912 KB
01_rndsmall_16.txt AC 22 ms 928 KB
01_rndsmall_17.txt AC 23 ms 916 KB
01_rndsmall_18.txt AC 23 ms 888 KB
01_rndsmall_19.txt AC 23 ms 856 KB
02_rndmax_00.txt WA 113 ms 2304 KB
02_rndmax_01.txt WA 120 ms 2268 KB
02_rndmax_02.txt WA 123 ms 1872 KB
02_rndmax_03.txt WA 118 ms 2264 KB
02_rndmax_04.txt WA 118 ms 2004 KB
02_rndmax_05.txt WA 118 ms 2520 KB
02_rndmax_06.txt RE 365 ms 11788 KB
02_rndmax_07.txt WA 127 ms 6104 KB
02_rndmax_08.txt WA 119 ms 2268 KB
02_rndmax_09.txt WA 117 ms 2264 KB
02_rndmax_10.txt WA 115 ms 2372 KB
02_rndmax_11.txt WA 117 ms 2776 KB
02_rndmax_12.txt WA 118 ms 2264 KB
02_rndmax_13.txt WA 131 ms 8444 KB
02_rndmax_14.txt RE 361 ms 11776 KB
02_rndmax_15.txt WA 120 ms 2136 KB
02_rndmax_16.txt WA 120 ms 3544 KB
02_rndmax_17.txt WA 117 ms 3556 KB
02_rndmax_18.txt WA 117 ms 2772 KB
02_rndmax_19.txt WA 117 ms 2260 KB
03_rnd_00.txt AC 24 ms 780 KB
03_rnd_01.txt WA 44 ms 1752 KB
03_rnd_02.txt AC 43 ms 980 KB
03_rnd_03.txt WA 47 ms 1748 KB
03_rnd_04.txt WA 50 ms 1364 KB
03_rnd_05.txt AC 29 ms 1048 KB
03_rnd_06.txt AC 61 ms 1476 KB
03_rnd_07.txt WA 35 ms 1108 KB
03_rnd_08.txt WA 79 ms 3920 KB
03_rnd_09.txt WA 66 ms 1492 KB
04_empty_00.txt AC 110 ms 1884 KB
05_maxret_00.txt AC 133 ms 1812 KB