Submission #34303


Source Code Expand

Copy
#include<iostream>
#include<vector>

int h,w;         
int getF(std::vector<std::vector<int> >& field,int y,int x);

int main(){
  std::cin >> h >> w;
  std::vector<std::vector<int> > field;
  for(int i=0;i<h;i++){
    field.push_back(std::vector<int>());
    for(int j=0;j<w;j++){
      char c;
      std::cin >> c;
      if(c == '.')field[i].push_back(0);
      else field[i].push_back(1);
    }
  }
  int a=0,b=0,c=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(field[i][j]==1){
        int s=1;
        while(field[i+s][j+s]==1 && field[i+s][j]==1 && field[i][j+s]==1)s++;
        int p=getF(field,i,j)/s/s;
        if(p==12)a++;
        if(p==16)b++;
        if(p==11)c++;
      }
    }
  }
  std::cout<<a<<" "<<b<<" "<<c<<std::endl;
  return 0;
}

int getF(std::vector<std::vector<int> >& field,int y,int x){   
  int cnt=1;
  field[y][x]=0;
  if(y+1<h && field[y+1][x]==1)cnt+=getF(field,y+1,x);
  if(y>0   && field[y-1][x]==1)cnt+=getF(field,y-1,x);
  if(x+1<w && field[y][x+1]==1)cnt+=getF(field,y,x+1);
  if(x>0   && field[y][x-1]==1)cnt+=getF(field,y,x-1);
  if(y+1<h && x+1<w && field[y+1][x+1]==1)cnt+=getF(field,y+1,x+1);
  if(y>0   && x+1<w && field[y-1][x+1]==1)cnt+=getF(field,y-1,x+1);
  if(y+1<h && x>0   && field[y+1][x-1]==1)cnt+=getF(field,y+1,x-1);
  if(y>0   && x>0   && field[y-1][x-1]==1)cnt+=getF(field,y-1,x-1);
  return cnt;
}

Submission Info

Submission Time
Task D - アルファベット探し
User phi16
Language C++ (G++ 4.6.4)
Score 0
Code Size 1417 Byte
Status RE
Exec Time 371 ms
Memory 14852 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 20 ms 788 KB
00_sample_01.txt AC 21 ms 772 KB
00_sample_02.txt AC 21 ms 788 KB
00_sample_03.txt AC 22 ms 760 KB
00_sample_04.txt AC 22 ms 760 KB
00_sample_05.txt AC 21 ms 764 KB
01_rndsmall_00.txt AC 22 ms 816 KB
01_rndsmall_01.txt AC 23 ms 1048 KB
01_rndsmall_02.txt AC 23 ms 792 KB
01_rndsmall_03.txt AC 23 ms 792 KB
01_rndsmall_04.txt AC 22 ms 784 KB
01_rndsmall_05.txt AC 22 ms 788 KB
01_rndsmall_06.txt AC 23 ms 756 KB
01_rndsmall_07.txt AC 23 ms 792 KB
01_rndsmall_08.txt AC 22 ms 784 KB
01_rndsmall_09.txt AC 23 ms 788 KB
01_rndsmall_10.txt AC 22 ms 788 KB
01_rndsmall_11.txt AC 23 ms 892 KB
01_rndsmall_12.txt AC 23 ms 760 KB
01_rndsmall_13.txt AC 24 ms 784 KB
01_rndsmall_14.txt AC 23 ms 760 KB
01_rndsmall_15.txt AC 22 ms 916 KB
01_rndsmall_16.txt AC 22 ms 772 KB
01_rndsmall_17.txt AC 23 ms 788 KB
01_rndsmall_18.txt AC 21 ms 784 KB
01_rndsmall_19.txt AC 23 ms 868 KB
02_rndmax_00.txt AC 126 ms 5616 KB
02_rndmax_01.txt AC 127 ms 5864 KB
02_rndmax_02.txt AC 130 ms 4980 KB
02_rndmax_03.txt AC 128 ms 5756 KB
02_rndmax_04.txt AC 127 ms 5108 KB
02_rndmax_05.txt AC 131 ms 6392 KB
02_rndmax_06.txt RE 365 ms 14852 KB
02_rndmax_07.txt AC 144 ms 14212 KB
02_rndmax_08.txt AC 141 ms 6148 KB
02_rndmax_09.txt AC 126 ms 5756 KB
02_rndmax_10.txt AC 143 ms 5884 KB
02_rndmax_11.txt AC 128 ms 6388 KB
02_rndmax_12.txt AC 131 ms 5884 KB
02_rndmax_13.txt RE 371 ms 14840 KB
02_rndmax_14.txt RE 367 ms 14840 KB
02_rndmax_15.txt AC 128 ms 5616 KB
02_rndmax_16.txt AC 134 ms 9732 KB
02_rndmax_17.txt AC 127 ms 7540 KB
02_rndmax_18.txt AC 129 ms 6396 KB
02_rndmax_19.txt AC 129 ms 5892 KB
03_rnd_00.txt AC 24 ms 920 KB
03_rnd_01.txt AC 46 ms 2424 KB
03_rnd_02.txt AC 44 ms 1668 KB
03_rnd_03.txt AC 47 ms 2432 KB
03_rnd_04.txt AC 54 ms 3448 KB
03_rnd_05.txt AC 27 ms 1268 KB
03_rnd_06.txt AC 63 ms 3704 KB
03_rnd_07.txt AC 35 ms 1660 KB
03_rnd_08.txt AC 87 ms 8828 KB
03_rnd_09.txt AC 71 ms 4352 KB
04_empty_00.txt AC 119 ms 4864 KB
05_maxret_00.txt AC 132 ms 4856 KB