0_0_20611912_27331.cpp:6:6: error: expected unqualified-id before numeric constant
0; i = i - 1 & st) if(danger[i]) return 0; return 1; }void solve(){ int i, j, k, cur, st, ans = -1, D = (1 << N) - 1; std::queue <int> q; memset(vis, 0, sizeof(vis)); f[0][0] = 0, vis[0][0] = 1; q.push(0); while(!q.empty()) { cur = q.front() & 1, st = q.front() >> 1, q.pop(); if(cur == 1 && st == D) { ans = f[cur][st]; break; } if(cur == 1 && check(st) && !vis[0][st]) f[0][st] = f[1][st] + 1, vis[0][st] = 1, q.push(st << 1); if(cur == 0) st = ~st & D; for(i = st; i > 0; i = i - 1 & st) if(can(i) && check(st - i)) { if(cur == 0) { int t = ~(st - i) & D; if(!vis[1][t]) f[1][t] = f[0][~st & D] + 1, vis[1][t] = 1, q.push(t << 1 | 1); } else { int t = st - i; if(!vis[0][t]) f[0][t] = f[1][st] + 1, vis[0][t] = 1, q.push(t << 1); } } } printf("%d\n", ans);}int main(){ while(scanf("%d%d%d", &N, &M, &T) == 3) { init(); solve(); } return 0; }
^
0_0_20611912_27331.cpp:6:9: error: 'i' does not name a type
0; i = i - 1 & st) if(danger[i]) return 0; return 1; }void solve(){ int i, j, k, cur, st, ans = -1, D = (1 << N) - 1; std::queue <int> q; memset(vis, 0, sizeof(vis)); f[0][0] = 0, vis[0][0] = 1; q.push(0); while(!q.empty()) { cur = q.front() & 1, st = q.front() >> 1, q.pop(); if(cur == 1 && st == D) { ans = f[cur][st]; break; } if(cur == 1 && check(st) && !vis[0][st]) f[0][st] = f[1][st] + 1, vis[0][st] = 1, q.push(st << 1); if(cur == 0) st = ~st & D; for(i = st; i > 0; i = i - 1 & st) if(can(i) && check(st - i)) { if(cur == 0) { int t = ~(st - i) & D; if(!vis[1][t]) f[1][t] = f[0][~st & D] + 1, vis[1][t] = 1, q.push(t << 1 | 1); } else { int t = st - i; if(!vis[0][t]) f[0][t] = f[1][st] + 1, vis[0][t] = 1, q.push(t << 1); } } } printf("%d\n", ans);}int main(){ while(scanf("%d%d%d", &N, &M, &T) == 3) { init(); solve(); } return 0; }
^
0_0_20611912_27331.cpp:6:59: error: expected unqualified-id before 'return'
0; i = i - 1 & st) if(danger[i]) return 0; return 1; }void solve(){ int i, j, k, cur, st, ans = -1, D = (1 << N) - 1; std::queue <int> q; memset(vis, 0, sizeof(vis)); f[0][0] = 0, vis[0][0] = 1; q.push(0); while(!q.empty()) { cur = q.front() & 1, st = q.front() >> 1, q.pop(); if(cur == 1 && st == D) { ans = f[cur][st]; break; } if(cur == 1 && check(st) && !vis[0][st]) f[0][st] = f[1][st] + 1, vis[0][st] = 1, q.push(st << 1); if(cur == 0) st = ~st & D; for(i = st; i > 0; i = i - 1 & st) if(can(i) && check(st - i)) { if(cur == 0) { int t = ~(st - i) & D; if(!vis[1][t]) f[1][t] = f[0][~st & D] + 1, vis[1][t] = 1, q.push(t << 1 | 1); } else { int t = st - i; if(!vis[0][t]) f[0][t] = f[1][st] + 1, vis[0][t] = 1, q.push(t << 1); } } } printf("%d\n", ans);}int main(){ while(scanf("%d%d%d", &N, &M, &T) == 3) { init(); solve(); } return 0; }
^
0_0_20611912_27331.cpp:6:72: error: expected declaration before '}' token
0; i = i - 1 & st) if(danger[i]) return 0; return 1; }void solve(){ int i, j, k, cur, st, ans = -1, D = (1 << N) - 1; std::queue <int> q; memset(vis, 0, sizeof(vis)); f[0][0] = 0, vis[0][0] = 1; q.push(0); while(!q.empty()) { cur = q.front() & 1, st = q.front() >> 1, q.pop(); if(cur == 1 && st == D) { ans = f[cur][st]; break; } if(cur == 1 && check(st) && !vis[0][st]) f[0][st] = f[1][st] + 1, vis[0][st] = 1, q.push(st << 1); if(cur == 0) st = ~st & D; for(i = st; i > 0; i = i - 1 & st) if(can(i) && check(st - i)) { if(cur == 0) { int t = ~(st - i) & D; if(!vis[1][t]) f[1][t] = f[0][~st & D] + 1, vis[1][t] = 1, q.push(t << 1 | 1); } else { int t = st - i; if(!vis[0][t]) f[0][t] = f[1][st] + 1, vis[0][t] = 1, q.push(t << 1); } } } printf("%d\n", ans);}int main(){ while(scanf("%d%d%d", &N, &M, &T) == 3) { init(); solve(); } return 0; }
^
|