Submission #34274


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 A - 宝くじ
User phi16
Language C++ (G++ 4.6.4)
Score 0
Code Size 1417 Byte
Status WA
Exec Time 270 ms
Memory 820 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 32
RE × 19
Set Name Test Cases
All 00_1_01.txt, 00_1_02.txt, 00_2_01.txt, 00_2_02.txt, 00_3_01.txt, 00_3_02.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 01_rand_10.txt, 01_rand_11.txt, 01_rand_12.txt, 01_rand_13.txt, 01_rand_14.txt, 01_rand_15.txt, 01_rand_16.txt, 01_rand_17.txt, 01_rand_18.txt, 01_rand_19.txt, 01_rand_20.txt, 01_rand_21.txt, 01_rand_22.txt, 01_rand_23.txt, 01_rand_24.txt, 01_rand_25.txt, 01_rand_26.txt, 01_rand_27.txt, 01_rand_28.txt, 01_rand_29.txt, 01_rand_30.txt, 01_rand_31.txt, 01_rand_32.txt, 01_rand_33.txt, 01_rand_34.txt, 01_rand_35.txt, 01_rand_36.txt, 01_rand_37.txt, 01_rand_38.txt, 01_rand_39.txt
Case Name Status Exec Time Memory
00_1_01.txt RE 258 ms 788 KB
00_1_02.txt RE 262 ms 788 KB
00_2_01.txt WA 22 ms 780 KB
00_2_02.txt RE 253 ms 788 KB
00_3_01.txt WA 22 ms 760 KB
00_3_02.txt RE 254 ms 812 KB
00_sample_01.txt RE 247 ms 764 KB
00_sample_02.txt WA 21 ms 796 KB
00_sample_03.txt WA 20 ms 788 KB
00_sample_04.txt RE 245 ms 788 KB
00_sample_05.txt WA 20 ms 788 KB
01_rand_00.txt WA 21 ms 796 KB
01_rand_01.txt WA 21 ms 788 KB
01_rand_02.txt WA 22 ms 776 KB
01_rand_03.txt WA 21 ms 792 KB
01_rand_04.txt WA 21 ms 792 KB
01_rand_05.txt RE 253 ms 784 KB
01_rand_06.txt RE 252 ms 812 KB
01_rand_07.txt WA 20 ms 756 KB
01_rand_08.txt WA 21 ms 788 KB
01_rand_09.txt WA 21 ms 788 KB
01_rand_10.txt WA 21 ms 788 KB
01_rand_11.txt WA 20 ms 788 KB
01_rand_12.txt WA 21 ms 792 KB
01_rand_13.txt WA 21 ms 792 KB
01_rand_14.txt RE 244 ms 788 KB
01_rand_15.txt WA 21 ms 820 KB
01_rand_16.txt WA 21 ms 788 KB
01_rand_17.txt RE 253 ms 788 KB
01_rand_18.txt RE 252 ms 792 KB
01_rand_19.txt WA 21 ms 792 KB
01_rand_20.txt RE 249 ms 784 KB
01_rand_21.txt WA 22 ms 756 KB
01_rand_22.txt WA 20 ms 772 KB
01_rand_23.txt RE 248 ms 792 KB
01_rand_24.txt WA 21 ms 780 KB
01_rand_25.txt WA 21 ms 788 KB
01_rand_26.txt WA 21 ms 788 KB
01_rand_27.txt WA 23 ms 816 KB
01_rand_28.txt WA 21 ms 764 KB
01_rand_29.txt RE 270 ms 768 KB
01_rand_30.txt RE 263 ms 796 KB
01_rand_31.txt RE 250 ms 792 KB
01_rand_32.txt WA 21 ms 816 KB
01_rand_33.txt WA 20 ms 784 KB
01_rand_34.txt RE 250 ms 788 KB
01_rand_35.txt WA 20 ms 784 KB
01_rand_36.txt WA 21 ms 784 KB
01_rand_37.txt RE 253 ms 780 KB
01_rand_38.txt WA 22 ms 760 KB
01_rand_39.txt RE 257 ms 736 KB