hiho week 58 register

Ended

Participants:384

Verdict:Accepted
Score:100 / 100
Submitted:2015-08-10 12:58:20

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h> 
 main(){
    int m; int c[10000000];char c1[10000000],a[10000000];
    scanf("%d",&m);
    while(m--){
        int g;scanf("%d",&g);int i; a[g]='A';
        scanf("%c",&a[0]);
        for(i=0;i<g;i++) scanf("%c",&a[i]); 
        int j=0;char t=a[0];int s=1;
        for(i=1;i<=g;i++) { 
            if (a[i]==t) s++;
            else{c[j]=s;s=1;c1[j]=t;t=a[i];j++;}
        }
/*for(i=0;i<j;i++)
   printf("%c %d\n",c1[i],c[i]);*/
        int kaiguan=0;  
  for(i=1;i<j-1;i++)
      if(c1[i-1]+1==c1[i]&&c1[i]==c1[i+1]-1&&c[i-1]>=c[i]&&c[i]<=c[i+1])
      {kaiguan=1;printf("YES\n");break;} 
    if(kaiguan==0)  
      printf("NO\n");
    }
  
  }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX