제출 #107599

#제출 시각아이디문제언어결과실행 시간메모리
107599patrikpavic2경찰관과 강도 (BOI14_coprobber)C++17
0 / 100
3 ms640 KiB
#include "coprobber.h"
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>

int mv = 0, pos, n, m;
bool a[MAX_N][MAX_N];

int start(int N, bool A[MAX_N][MAX_N]){
    for(int i = 0;i < MAX_N;i++){
        for(int j = 0;j < MAX_N;j++){
            a[i][j] = A[i][j];
        }
    }
    m = 0;
    while(A[m][m + 1]) m++;m++;
    n = N / m;
    if(n <= 3 && m <= 3){
        if(n == 3 && m == 3)
            return pos = 4;
        return pos = 1;
    }
    else if(n <= 3 || m <= 3){
        if(n == 2) return pos = m / 2;
        return pos = n / 2;
    }
    return -1;
}

int nextMove(int R){
    if(a[R][pos]) return R;
    if(n <= 3 && m <= 3) return pos;
    if(n == 2){
        int r = R % m;
        int p = pos % m;
        if(p < r) return pos = pos + 1;
        return pos = pos - 1;
    }
    if(m == 2){
        int r = R / 2;
        int p = pos / 2;
        if(p < r) return pos = pos + 2;
        return pos = pos - 2;
    }

}

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

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:19:5: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
     while(A[m][m + 1]) m++;m++;
     ^~~~~
coprobber.cpp:19:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
     while(A[m][m + 1]) m++;m++;
                            ^
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:49: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...