This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
vector<vector<int>> AR;
int pos = 0, sz = 1;
int start(int N, bool A[500][500])
{
while (A[sz - 1][sz])
sz++;
return 0;
}
int nextMove(int R)
{
if (R / sz == pos / sz && R - pos == 1)
return R;
if (R % sz == pos % sz && R == pos + sz)
return R;
if (R % sz < pos % sz)
{
pos--;
return pos;
}
if (R % sz - 1 > pos % sz)
{
pos++;
return pos;
}
if (R % sz == pos % sz + 1 && R / sz == pos / sz + 1)
return pos;
pos += sz;
return pos;
}
/*int main()
{
intsz= 5;
bool A[5][5] = {{0, 1, 0, 0, 0}, {1, 0, 1, 0, 0}, {0, 1, 0, 1, 0}, {0, 0, 1, 0, 1}, {0, 0, 0, 1, 0}};
start(N, A);
nextMove(4);
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |