F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20613081_23308.cpp:5:5: error: expected unqualified-id before '=' token
     = 0; i --) code[i] = st & 7, st >>= 3;    }inline int encode(int *code, int m){    int i, st = 0, cnt = -1;    memset(h, -1, sizeof(h));    for(i = 0; i < m; i ++)    {        if(h[code[i]] == -1) h[code[i]] = ++ cnt;        st = st << 3 | h[code[i]];        }    return st;}void dp(int i, int j, int c, int cur){    int k;    for(k = 0; k < hm[cur].size; k ++)    {        int col = hm[cur].col[k], u = i ? (col >> j & 1) == c : 0, l = j ? (col >> j - 1 & 1) == c : 0, lu = i && j ? (col >> M) == c : 0;        if(u && l && lu) continue;        if(i == N - 1 && j == M - 1 && !u && !l && lu) continue;        decode(code, M, hm[cur].st[k]);        if(i && !u)        {            int t, s1 = 0, s2 = 0;            for(t = 0; t < M; t ++)            {                if(code[t] == code[j]) ++ s1;                if((col >> t & 1) != c) ++ s2;            }            if(s1 == 1)            {                if(s2 > 1) continue;                if(i < N - 1 || j < M - 2) continue;            }        }        if(l && u)        {            if(code[j] != code[j - 1])                for(int t = 0, x = code[j]; t < M; t ++)                    if(code[t] == x) code[t] = code[j - 1];        }        else if(l && !u) code[j] = code[j - 1];        else if(!l && !u) code[j] = M;         if(col & 1 << j) col |= 1 << M;        else col &= ~(1 << M);        if(c) col |= 1 << j;        else col &= ~(1 << j);         hm[cur ^ 1].push(encode(code, M), hm[cur].dif[k] + (c ? a[i][j] : -a[i][j]), col, hm[cur].dp[k], i * M + j, k, c ? 'x' : 'o');    }    }void print(int k){    int i, j;    for(i = N - 1; i >= 0; i --)        for(j = M - 1; j >= 0; j --)            g[i][j] = op[i * M + j][k], k = pre[i * M + j][k];    for(i = 0; i < N; i ++) printf("%s\n", g[i]);}void solve(){    int i, j, k, cur = 0, ans = 0, min = INF;    hm[0].init();    hm[0].push(0, 0, 0, 1, 0, 0, 0);    for(i = 0; i < N; i ++)        for(j = 0; j < M; j ++)        {            hm[cur ^ 1].init();            if(g[i][j] != 'x') dp(i, j, 0, cur);            if(g[i][j] != 'o') dp(i, j, 1, cur);            cur ^= 1;            }    for(i = 0; i < hm[cur].size; i ++)    {        int s1 = 0;        memset(h, 0, sizeof(h));        decode(code, M, hm[cur].st[i]);        for(j = 0; j < M; j ++) if(!h[code[j]]) ++ s1, h[code[j]] = 1;        if(s1 <= 2)        {            if(std::abs(hm[cur].dif[i]) < min)                min = std::abs(hm[cur].dif[i]), ans = hm[cur].dp[i], k = i;            else if(std::abs(hm[cur].dif[i]) == min)                ans += hm[cur].dp[i];        }    }    if(min == INF) printf("0 0\n");    else    {        printf("%d %d\n", min, ans);        print(k);    }}int main(){    int t, tt;    scanf("%d", &t);    for(tt = 1; tt <= t; tt ++)    {        init();        printf("Case %d: ", tt);        solve();            printf("\n");    }    return 0;    }
     ^
0_0_20613081_23308.cpp:5:10: error: 'i' does not name a type
     = 0; i --) code[i] = st & 7, st >>= 3;    }inline int encode(int *code, int m){    int i, st = 0, cnt = -1;    memset(h, -1, sizeof(h));    for(i = 0; i < m; i ++)    {        if(h[code[i]] == -1) h[code[i]] = ++ cnt;        st = st << 3 | h[code[i]];        }    return st;}void dp(int i, int j, int c, int cur){    int k;    for(k = 0; k < hm[cur].size; k ++)    {        int col = hm[cur].col[k], u = i ? (col >> j & 1) == c : 0, l = j ? (col >> j - 1 & 1) == c : 0, lu = i && j ? (col >> M) == c : 0;        if(u && l && lu) continue;        if(i == N - 1 && j == M - 1 && !u && !l && lu) continue;        decode(code, M, hm[cur].st[k]);        if(i && !u)        {            int t, s1 = 0, s2 = 0;            for(t = 0; t < M; t ++)            {                if(code[t] == code[j]) ++ s1;                if((col >> t & 1) != c) ++ s2;            }            if(s1 == 1)            {                if(s2 > 1) continue;                if(i < N - 1 || j < M - 2) continue;            }        }        if(l && u)        {            if(code[j] != code[j - 1])                for(int t = 0, x = code[j]; t < M; t ++)                    if(code[t] == x) code[t] = code[j - 1];        }        else if(l && !u) code[j] = code[j - 1];        else if(!l && !u) code[j] = M;         if(col & 1 << j) col |= 1 << M;        else col &= ~(1 << M);        if(c) col |= 1 << j;        else col &= ~(1 << j);         hm[cur ^ 1].push(encode(code, M), hm[cur].dif[k] + (c ? a[i][j] : -a[i][j]), col, hm[cur].dp[k], i * M + j, k, c ? 'x' : 'o');    }    }void print(int k){    int i, j;    for(i = N - 1; i >= 0; i --)        for(j = M - 1; j >= 0; j --)            g[i][j] = op[i * M + j][k], k = pre[i * M + j][k];    for(i = 0; i < N; i ++) printf("%s\n", g[i]);}void solve(){    int i, j, k, cur = 0, ans = 0, min = INF;    hm[0].init();    hm[0].push(0, 0, 0, 1, 0, 0, 0);    for(i = 0; i < N; i ++)        for(j = 0; j < M; j ++)        {            hm[cur ^ 1].init();            if(g[i][j] != 'x') dp(i, j, 0, cur);            if(g[i][j] != 'o') dp(i, j, 1, cur);            cur ^= 1;            }    for(i = 0; i < hm[cur].size; i ++)    {        int s1 = 0;        memset(h, 0, sizeof(h));        decode(code, M, hm[cur].st[i]);        for(j = 0; j < M; j ++) if(!h[code[j]]) ++ s1, h[code[j]] = 1;        if(s1 <= 2)        {            if(std::abs(hm[cur].dif[i]) < min)                min = std::abs(hm[cur].dif[i]), ans = hm[cur].dp[i], k = i;            else if(std::abs(hm[cur].dif[i]) == min)                ans += hm[cur].dp[i];        }    }    if(min == INF) printf("0 0\n");    else    {        printf("%d %d\n", min, ans);        print(k);    }}int main(){    int t, tt;    scanf("%d", &t);    for(tt = 1; tt <= t; tt ++)    {        init();        printf("Case %d: ", tt);        solve();            printf("\n");    }    return 0;    }
          ^
0_0_20613081_23308.cpp:5:47: error: expected declaration before '}' token
     = 0; i --) code[i] = st & 7, st >>= 3;    }inline int encode(int *code, int m){    int i, st = 0, cnt = -1;    memset(h, -1, sizeof(h));    for(i = 0; i < m; i ++)    {        if(h[code[i]] == -1) h[code[i]] = ++ cnt;        st = st << 3 | h[code[i]];        }    return st;}void dp(int i, int j, int c, int cur){    int k;    for(k = 0; k < hm[cur].size; k ++)    {        int col = hm[cur].col[k], u = i ? (col >> j & 1) == c : 0, l = j ? (col >> j - 1 & 1) == c : 0, lu = i && j ? (col >> M) == c : 0;        if(u && l && lu) continue;        if(i == N - 1 && j == M - 1 && !u && !l && lu) continue;        decode(code, M, hm[cur].st[k]);        if(i && !u)        {            int t, s1 = 0, s2 = 0;            for(t = 0; t < M; t ++)            {                if(code[t] == code[j]) ++ s1;                if((col >> t & 1) != c) ++ s2;            }            if(s1 == 1)            {                if(s2 > 1) continue;                if(i < N - 1 || j < M - 2) continue;            }        }        if(l && u)        {            if(code[j] != code[j - 1])                for(int t = 0, x = code[j]; t < M; t ++)                    if(code[t] == x) code[t] = code[j - 1];        }        else if(l && !u) code[j] = code[j - 1];        else if(!l && !u) code[j] = M;         if(col & 1 << j) col |= 1 << M;        else col &= ~(1 << M);        if(c) col |= 1 << j;        else col &= ~(1 << j);         hm[cur ^ 1].push(encode(code, M), hm[cur].dif[k] + (c ? a[i][j] : -a[i][j]), col, hm[cur].dp[k], i * M + j, k, c ? 'x' : 'o');    }    }void print(int k){    int i, j;    for(i = N - 1; i >= 0; i --)        for(j = M - 1; j >= 0; j --)            g[i][j] = op[i * M + j][k], k = pre[i * M + j][k];    for(i = 0; i < N; i ++) printf("%s\n", g[i]);}void solve(){    int i, j, k, cur = 0, ans = 0, min = INF;    hm[0].init();    hm[0].push(0, 0, 0, 1, 0, 0, 0);    for(i = 0; i < N; i ++)        for(j = 0; j < M; j ++)        {            hm[cur ^ 1].init();            if(g[i][j] != 'x') dp(i, j, 0, cur);            if(g[i][j] != 'o') dp(i, j, 1, cur);            cur ^= 1;            }    for(i = 0; i < hm[cur].size; i ++)    {        int s1 = 0;        memset(h, 0, sizeof(h));        decode(code, M, hm[cur].st[i]);        for(j = 0; j < M; j ++) if(!h[code[j]]) ++ s1, h[code[j]] = 1;        if(s1 <= 2)        {            if(std::abs(hm[cur].dif[i]) < min)                min = std::abs(hm[cur].dif[i]), ans = hm[cur].dp[i], k = i;            else if(std::abs(hm[cur].dif[i]) == min)                ans += hm[cur].dp[i];        }    }    if(min == INF) printf("0 0\n");    else    {        printf("%d %d\n", min, ans);        print(k);    }}int main(){    int t, tt;    scanf("%d", &t);    for(tt = 1; tt <= t; tt ++)    {        init();        printf("Case %d: ", tt);        solve();            printf("\n");    }    return 0;    }
                                               ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 08:27:30, Gzip enabled