Submission #34439


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

char field[1001][1001];
bool used[1001][1001];
int H,W;

int dfs(int cy,int cx){
  int res=1;
  used[cy][cx]=true;
  for(int dy=-1;dy<=1;dy++){
    for(int dx=-1;dx<=1;dx++){
      int ny=dy+cy;
      int nx=dx+cx;
      if(ny>=0&&nx>=0&&ny<H&&nx<W&&field[ny][nx]=='o'&&!used[ny][nx])
	res+=dfs(ny,nx);
    }
  }
  return res;
}

int main(){
  std::ios_base::sync_with_stdio(0);
  cin>>H>>W;
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      cin>>field[i][j];
  int sa,sb,sc;
  sa=sb=sc=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(field[i][j]=='o'&&!used[i][j]){
	int a=dfs(i,j);
	//cout<<a<<endl;
	for(int k=1;k<150;k++){
	  if(a%(k*k)==0){
	    int b=a/(k*k);
	    if(b==12)sa++;
	    else if(b==16)sb++;
	    else if(b==11)sc++;
	  }
	}
      }
    }
  }
  cout<<sa<<" "<<sb<<" "<<sc<<endl;
  
  return 0;
}

Submission Info

Submission Time
Task D - アルファベット探し
User ishikado
Language C++ (G++ 4.6.4)
Score 0
Code Size 986 Byte
Status RE
Exec Time 288 ms
Memory 12412 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 55
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 21 ms 780 KB
00_sample_01.txt AC 21 ms 772 KB
00_sample_02.txt AC 21 ms 784 KB
00_sample_03.txt AC 21 ms 772 KB
00_sample_04.txt AC 21 ms 776 KB
00_sample_05.txt AC 22 ms 908 KB
01_rndsmall_00.txt AC 23 ms 1032 KB
01_rndsmall_01.txt AC 22 ms 1164 KB
01_rndsmall_02.txt AC 22 ms 1024 KB
01_rndsmall_03.txt AC 22 ms 1036 KB
01_rndsmall_04.txt AC 22 ms 1032 KB
01_rndsmall_05.txt AC 22 ms 1036 KB
01_rndsmall_06.txt AC 23 ms 1032 KB
01_rndsmall_07.txt AC 22 ms 1028 KB
01_rndsmall_08.txt AC 23 ms 1028 KB
01_rndsmall_09.txt AC 21 ms 1036 KB
01_rndsmall_10.txt AC 22 ms 904 KB
01_rndsmall_11.txt AC 23 ms 1040 KB
01_rndsmall_12.txt AC 22 ms 1032 KB
01_rndsmall_13.txt AC 22 ms 896 KB
01_rndsmall_14.txt AC 22 ms 1020 KB
01_rndsmall_15.txt AC 22 ms 1040 KB
01_rndsmall_16.txt AC 22 ms 1020 KB
01_rndsmall_17.txt AC 21 ms 900 KB
01_rndsmall_18.txt AC 22 ms 1028 KB
01_rndsmall_19.txt AC 22 ms 1020 KB
02_rndmax_00.txt AC 58 ms 3584 KB
02_rndmax_01.txt AC 64 ms 3452 KB
02_rndmax_02.txt AC 72 ms 2824 KB
02_rndmax_03.txt AC 64 ms 3324 KB
02_rndmax_04.txt AC 68 ms 2940 KB
02_rndmax_05.txt AC 65 ms 3840 KB
02_rndmax_06.txt RE 280 ms 12296 KB
02_rndmax_07.txt AC 73 ms 9860 KB
02_rndmax_08.txt AC 63 ms 3716 KB
02_rndmax_09.txt AC 64 ms 3460 KB
02_rndmax_10.txt AC 59 ms 3584 KB
02_rndmax_11.txt AC 62 ms 4472 KB
02_rndmax_12.txt AC 60 ms 3448 KB
02_rndmax_13.txt RE 288 ms 12412 KB
02_rndmax_14.txt RE 278 ms 12284 KB
02_rndmax_15.txt AC 68 ms 3324 KB
02_rndmax_16.txt AC 68 ms 6404 KB
02_rndmax_17.txt AC 64 ms 5624 KB
02_rndmax_18.txt AC 60 ms 4344 KB
02_rndmax_19.txt AC 63 ms 3460 KB
03_rnd_00.txt AC 23 ms 764 KB
03_rnd_01.txt AC 32 ms 2424 KB
03_rnd_02.txt AC 30 ms 1284 KB
03_rnd_03.txt AC 32 ms 2424 KB
03_rnd_04.txt AC 34 ms 1788 KB
03_rnd_05.txt AC 24 ms 1028 KB
03_rnd_06.txt AC 41 ms 1920 KB
03_rnd_07.txt AC 27 ms 1280 KB
03_rnd_08.txt AC 49 ms 6020 KB
03_rnd_09.txt AC 41 ms 2056 KB
04_empty_00.txt AC 51 ms 1792 KB
05_maxret_00.txt AC 85 ms 2764 KB