Submission #1075980

#TimeUsernameProblemLanguageResultExecution timeMemory
1075980aboutonCop and Robber (BOI14_coprobber)C++17
14 / 100
37 ms1828 KiB
#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;

int L, C;
int pos = 0;

int start(int N, bool A[MAX_N][MAX_N])
{
    for (int i = 1; i < N; i ++)
    {
        if (A[0][i]) C = i;
    }
    L = N/C;
    return 0;
}

int nextMove(int R)
{
    int lR, cR, lP, cP;
    lR = R/C; cR = R%C;
    lP = pos/C; cP = pos%C;

    if (lR >= lP+2)
    {
        pos += C;
        return pos;
    }
    else if (lR <= lP-2)
    {
        pos -=C;
        return pos;
    }
    else if (cR >= cP+2)
    {
        pos += 1;
        return pos;
    }
    else if (cR <= cP-2)
    {
        pos -= 1;
        return pos;
    }
    else if (abs(lR-lP)+abs(cR-cP)==1)
    {
        pos = R;
        return pos;
    }
    return pos;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...