Submission #34443


Source Code Expand

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

using namespace std;

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

typedef pair<int,int> pii;
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=1;
	queue<pii> q;
	q.push(pii(i,j));
	used[i][j]=true;
	while(q.size()){
	  pii p=q.front();q.pop();
	  int cy=p.first;
	  int cx=p.second;
	  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]){
		used[ny][nx]=true;
		q.push(pii(ny,nx));
		a++;
	      }
	    }
	  }
	}
	//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 100
Code Size 1144 Byte
Status AC
Exec Time 97 ms
Memory 2772 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 58
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 792 KB
00_sample_01.txt AC 21 ms 788 KB
00_sample_02.txt AC 22 ms 792 KB
00_sample_03.txt AC 21 ms 788 KB
00_sample_04.txt AC 22 ms 756 KB
00_sample_05.txt AC 21 ms 936 KB
01_rndsmall_00.txt AC 21 ms 1048 KB
01_rndsmall_01.txt AC 22 ms 912 KB
01_rndsmall_02.txt AC 22 ms 1044 KB
01_rndsmall_03.txt AC 22 ms 916 KB
01_rndsmall_04.txt AC 22 ms 920 KB
01_rndsmall_05.txt AC 23 ms 1024 KB
01_rndsmall_06.txt AC 22 ms 928 KB
01_rndsmall_07.txt AC 23 ms 1020 KB
01_rndsmall_08.txt AC 23 ms 1044 KB
01_rndsmall_09.txt AC 23 ms 1048 KB
01_rndsmall_10.txt AC 28 ms 896 KB
01_rndsmall_11.txt AC 21 ms 920 KB
01_rndsmall_12.txt AC 22 ms 988 KB
01_rndsmall_13.txt AC 22 ms 908 KB
01_rndsmall_14.txt AC 22 ms 1028 KB
01_rndsmall_15.txt AC 22 ms 1048 KB
01_rndsmall_16.txt AC 22 ms 896 KB
01_rndsmall_17.txt AC 22 ms 1016 KB
01_rndsmall_18.txt AC 21 ms 1036 KB
01_rndsmall_19.txt AC 23 ms 1040 KB
02_rndmax_00.txt AC 60 ms 2772 KB
02_rndmax_01.txt AC 65 ms 2684 KB
02_rndmax_02.txt AC 77 ms 2684 KB
02_rndmax_03.txt AC 68 ms 2688 KB
02_rndmax_04.txt AC 73 ms 2672 KB
02_rndmax_05.txt AC 67 ms 2680 KB
02_rndmax_06.txt AC 63 ms 2432 KB
02_rndmax_07.txt AC 61 ms 2424 KB
02_rndmax_08.txt AC 64 ms 2684 KB
02_rndmax_09.txt AC 62 ms 2688 KB
02_rndmax_10.txt AC 62 ms 2676 KB
02_rndmax_11.txt AC 64 ms 2680 KB
02_rndmax_12.txt AC 62 ms 2684 KB
02_rndmax_13.txt AC 64 ms 2680 KB
02_rndmax_14.txt AC 68 ms 2420 KB
02_rndmax_15.txt AC 74 ms 2660 KB
02_rndmax_16.txt AC 65 ms 2684 KB
02_rndmax_17.txt AC 60 ms 2652 KB
02_rndmax_18.txt AC 62 ms 2612 KB
02_rndmax_19.txt AC 66 ms 2688 KB
03_rnd_00.txt AC 23 ms 916 KB
03_rnd_01.txt AC 33 ms 2036 KB
03_rnd_02.txt AC 34 ms 1284 KB
03_rnd_03.txt AC 32 ms 1788 KB
03_rnd_04.txt AC 34 ms 1396 KB
03_rnd_05.txt AC 25 ms 916 KB
03_rnd_06.txt AC 44 ms 1912 KB
03_rnd_07.txt AC 27 ms 1144 KB
03_rnd_08.txt AC 46 ms 2552 KB
03_rnd_09.txt AC 45 ms 1916 KB
04_empty_00.txt AC 52 ms 1788 KB
05_maxret_00.txt AC 97 ms 2688 KB