제출 #38552

#제출 시각아이디문제언어결과실행 시간메모리
38552Waschbar경찰관과 강도 (BOI14_coprobber)C++14
16 / 100
44 ms2296 KiB
#include <bits/stdc++.h> #include "coprobber.h" using namespace std; int n, nn, mm, s, timer, tp, tpp; int p[1000], tin[1000], tout[1000]; bool ind; bool g[1000][1000]; bool used[1000]; void DFS(int f, int pr) { p[f] = pr; tin[f] = ++timer; used[f] = 1; for(int i = 0; i < n; i++) { if(!g[f][i] || i == pr) continue; if(used[i]) { ind = 1; continue;} DFS(i,f); } tout[f] = timer; } bool upper(int x, int y) { //cout << x << " - " << tin[x] << " " << tout[x] << " | " << y << " - " << tin[y] << " " << tout[y] << endl; return ((tin[x] <= tin[y]) && (tout[x] >= tout[y])); } int start(int N, bool A[MAX_N][MAX_N]) { n = N; s = 0; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) g[i][j] = A[i][j]; DFS(0, -1); if(!ind) tp = 1; else tp = 2; if(tp == 1) return 0; if(tp == 2) { mm = 0; while(g[mm][mm+1]) mm++; mm++; nn = n/mm; if(nn == 2) {tpp = 1; s=0; return s;} else if(mm == 2) {tpp = 2; s=0; return -1;} else if(nn == 3) {tpp = 3; s=mm+1; return -1;} else if(mm == 3) {tpp = 4; s=1; return -1;} return -1; } } int nextMove(int R) { if(tp == 1){ for(int i = 0; i < n; i++) { //cout << s << " " << i << " " << g[s][i] << endl; if(!g[s][i] || i == p[s]) continue; if(upper(i,R)) {s = i; return i;} } return -1; } if(tp == 2) { if(tpp == 1) { if(g[s][R]) return R; s++; return s; } if(tpp == 2) { if(g[s][R]) return R; s+=2; return s; } if(tpp == 3) { if(g[s][R]) return R; s++; return s; } if(tpp == 4) { if(g[s][R]) return R; s+=3; return s; } } }

컴파일 시 표준 에러 (stderr) 메시지

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:88:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...