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_31556343_17106.cpp: In function 'bool dfs(UINT, int)':
0_0_31556343_17106.cpp:3:2091: error: expected '}' at end of input
 UINT rowMask[4][4] = {0}, wholeRowMask[4] = {0};UINT colMask[4][4] = {0}, wholeColMask[4] = {0};/*0  1  2  34  5  6  78  9  10 1112 13 14 15*/void initMask(){    for(int i = 0; i < 4; ++i){        for(int j = 0; j < 4; ++j){            rowMask[i][j] = static_cast<UINT>(0x03) << ((4*i+j) << 1);            wholeRowMask[i] |= rowMask[i][j];            colMask[i][j] = static_cast<UINT>(0x03) << ((i+4*j) << 1);            wholeColMask[i] |= colMask[i][j];        }    }}inline bool rowSame(UINT state){    UINT tmp = state & wholeRowMask[0];    return tmp == (state & wholeRowMask[1]) >> 8 &&           tmp == (state & wholeRowMask[2]) >> 16 &&           tmp == (state & wholeRowMask[3]) >> 24 ;}inline bool colSame(UINT state){    UINT tmp = state & wholeColMask[0];    return tmp == (state & wholeColMask[1]) >> 2 &&           tmp == (state & wholeColMask[2]) >> 4 &&           tmp == (state & wholeColMask[3]) >> 6 ;}inline UINT rotateLeft(UINT state, int row){    UINT res = state & ~wholeRowMask[row];    res |= (rowMask[row][1] & state) >> 2;    res |= (rowMask[row][2] & state) >> 2;    res |= (rowMask[row][3] & state) >> 2;    res |= (rowMask[row][0] & state) << 6;    return res;}inline UINT rotateRight(UINT state, int row){    UINT res = state & ~wholeRowMask[row];    res |= (rowMask[row][0] & state) << 2;    res |= (rowMask[row][1] & state) << 2;    res |= (rowMask[row][2] & state) << 2;    res |= (rowMask[row][3] & state) >> 6;    return res;}inline UINT rotateUp(UINT state, int col){    UINT res = state & ~wholeColMask[col];    res |= (colMask[col][1] & state) >> 8;    res |= (colMask[col][2] & state) >> 8;    res |= (colMask[col][3] & state) >> 8;    res |= (colMask[col][0] & state) << 24;    return res;}inline UINT rotateDown(UINT state, int col){    UINT res = state & ~wholeColMask[col];    res |= (colMask[col][0] & state) << 8;    res |= (colMask[col][1] & state) << 8;    res |= (colMask[col][2] & state) << 8;    res |= (colMask[col][3] & state) >> 24;    return res;}bool dfs(UINT state, int steps){    if(steps == 0) return rowSame(state) || colSame(state);//try to rotate one row or one col    --steps;    for(int i = 0; i < 4; ++i){        if(dfs(rotateLeft(state, i), steps)) return true;        if(dfs(rotateRight(state, i), steps)) return true;        if(dfs(rotateUp(state, i), steps)) return true;        if(dfs(rotateDown(state, i), steps)) return true;    }    return false;}int main(){    int test, i, j, n, steps;    UINT state;     initMask();    for(scanf("%d", &test); test; --test){        state = 0;        for(i = 0; i < 4; ++i){            for(j = 0; j < 4; ++j){                scanf("%d", &n);                state |= static_cast<UINT>(n-1) << ((4*i+j) << 1);            }        }        for(steps = 0; steps < 6; ++steps){            if(dfs(state, steps)) break;        }        printf("%d\n", steps < 6 ? steps : -1);    }     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-12-02 03:45:02, Gzip enabled