hiho week 58 register

Ended

Participants:384

Verdict:Accepted
Score:100 / 100
Submitted:2015-08-13 11:31:34

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
26
27
28
29
30
31
#include <cstdio>
#include <cstring>
#define rep(i,n) for(int i = 0; i < n; i++)
int main() {
    int T,N;
    scanf("%d",&T);
    rep(TT,T) {
        scanf("%d",&N); N++;
        char s[5]="####",c,r=0;
        int x[4] = {0};
        c = getchar();
        rep(NN,N) {
            c = getchar();
            if(r) continue;
            if(c!=s[3]) {
                s[0] = s[1];
                s[1] = s[2];
                s[2] = s[3];
                s[3] = c;
                x[0] = x[1];
                x[1] = x[2];
                x[2] = x[3];
                x[3] = 1;
            } else {
                x[3]++;
            }
            if(s[0]+1==s[1] && s[1]+1==s[2] && x[1] <= x[0] && x[1] <= x[2]) r = 1;
        }
        if(r) printf("YES\n");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX