hiho week 30 register

Ended

Participants:387

Verdict:Accepted
Score:100 / 100
Submitted:2015-01-29 13:53:17

Lang:GCC

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<stdio.h>
#define AN 100000
int solve(int *a, int *b, int n, int start);
int main()
{
    int task;
    int n;
    int a[AN];
    int b1[AN];
    int b2[AN];
    int yesTable[AN];
    int noTable[AN];
    int i,temp1,temp2;
    int yesCount, noCount;
    scanf("%d", &task);
    while (task--)
    {
        scanf("%d", &n);
        for (i = 0; i < n; i++)
            scanf("%d", &a[i]);
        temp1 = solve(a, b1, n, 0);
        temp2 = solve(a, b2, n, 1);
        if ((temp1 == 1) && (temp2 == 1))
        {
            yesCount = 0;
            noCount = 0;
            for (i = 0; i < n; i++)
            {
                if (b1[i] == b2[i])
                {
                    if (b1[i] == 1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX