hiho week 30 register

Ended

Participants:387

Verdict:Accepted
Score:100 / 100
Submitted:2015-01-26 10:17:38

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>
const int INF = 0x7f7f7f7f;
const int N = 100005;
int n;
int num[N], mine[2][N], ans[2][N], isAns[2], top[2];
void solve(int* a, int& ans, const int& x) {
    ans = 1;
    a[1] = x;
    for (int i = 2; i <= n + 1 && ans; ++i) {
        a[i] = num[i - 1] - a[i - 1] - a[i - 2];
        if (a[i] != 1 && a[i] != 0)
            ans = 0;
    }
    if (a[n + 1] != 0)
        ans = 0;
}
int main()
{
    int t;
    scanf("%d", &t);
    for (int Case = 1; Case <= t; ++Case) {
        scanf("%d", &n);
        for (int i = 1; i <= n; ++i)
            scanf("%d", &num[i]);
        memset(mine, 127, sizeof(mine));
        mine[0][0] = mine[1][0] = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX