#2152583

Solution for 2376: DisconnectedGame by dohatsu

Source Code Status Test Cases
    Policy: public     Reviewed: 34    
00.00 sec    4064 KB    34 lines     628 bytes    2017-01-10 19:38
#include<bits/stdc++.h>
using namespace std;
int N,cc,t[2];
bool visited[1005];
char a[1005][1005];
void dfs(int pos){
  if(visited[pos])return;
  visited[pos]=true;
  cc++;
  for(int i=0;i<N;i++)
    if(a[pos][i]=='Y')
      dfs(i);
}
int main(){ 
  scanf("%d",&N);
  int total=N*(N-1)/2;
  for(int i=0;i<N;i++){
    scanf("%s",a[i]);
    for(int j=0;j<i;j++)
      if(a[i][j]=='Y')total--;
  }
  for(int i=0;i<N;i++){
    if(visited[i])continue;
    cc=0;
    dfs(i);
    t[cc%2]++;    
  }
  int f=(t[0]==0&&t[1]==2?0:1);
  if( (t[0]==1&&t[1]==2) || total%2==f )cout<<"Taro"<<endl;
  else cout<<"Hanako"<<endl;
  return 0;
}


Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 42/42 C++ CPU: 00.00 sec Memory: 4064 KB Length: 628 B 2017-01-10 19:38 2017-01-10 19:38
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.00 sec 3184 KB
Case #2: : Accepted 00.00 sec 3168 KB
Case #3: : Accepted 00.00 sec 3144 KB
Case #4: : Accepted 00.00 sec 3156 KB
Case #5: : Accepted 00.00 sec 3224 KB
Case #6: : Accepted 00.00 sec 3120 KB
Case #7: : Accepted 00.00 sec 3112 KB
Case #8: : Accepted 00.00 sec 3052 KB
Case #9: : Accepted 00.00 sec 3180 KB
Case #10: : Accepted 00.00 sec 3124 KB
Case #11: : Accepted 00.00 sec 3184 KB
Case #12: : Accepted 00.00 sec 3092 KB
Case #13: : Accepted 00.00 sec 3176 KB
Case #14: : Accepted 00.00 sec 3156 KB
Case #15: : Accepted 00.00 sec 3136 KB
Case #16: : Accepted 00.00 sec 3116 KB
Case #17: : Accepted 00.00 sec 3140 KB
Case #18: : Accepted 00.00 sec 3204 KB
Case #19: : Accepted 00.00 sec 3136 KB
Case #20: : Accepted 00.00 sec 3180 KB
Case #21: : Accepted 00.00 sec 3032 KB
Case #22: : Accepted 00.00 sec 3152 KB
Case #23: : Accepted 00.00 sec 3168 KB
Case #24: : Accepted 00.00 sec 3204 KB
Case #25: : Accepted 00.00 sec 3160 KB
Case #26: : Accepted 00.00 sec 3168 KB
Case #27: : Accepted 00.00 sec 3160 KB
Case #28: : Accepted 00.00 sec 3172 KB
Case #29: : Accepted 00.00 sec 3172 KB
Case #30: : Accepted 00.00 sec 3208 KB
Case #31: : Accepted 00.00 sec 3192 KB
Case #32: : Accepted 00.00 sec 3208 KB
Case #33: : Accepted 00.00 sec 3172 KB
Case #34: : Accepted 00.00 sec 3060 KB
Case #35: : Accepted 00.00 sec 3168 KB
Case #36: : Accepted 00.00 sec 3172 KB
Case #37: : Accepted 00.00 sec 3980 KB
Case #38: : Accepted 00.00 sec 3976 KB
Case #39: : Accepted 00.00 sec 4064 KB
Case #40: : Accepted 00.00 sec 3092 KB
Case #41: : Accepted 00.00 sec 3116 KB
Case #42: : Accepted 00.00 sec 3136 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags