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>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
const ll inf = 1e18;
const int i_inf = 1e9;
const ll mod = 1e9+7;
const int mxn = 2e5+5;
#include "coprobber.h"
int deg[505];
int n, m;
int r[505];
int c[505];
int mat[505][505];
int start(int N, bool A[MAX_N][MAX_N])
{
fr(i, 0, N){
fr(j, 0, N){
if(A[i][j]) deg[i]++;
}
}
int f = 0;
fr(i, 1, N){
if(deg[i] == 2){
f = i;
break;
}
}
m = f+1;
n = N/m;
int id = 0;
fr(i, 0, n){
fr(j, 0, m){
++id;
r[id] = i;
c[id] = j;
mat[i][j] = id;
}
}
return 0;
}
int cop = 0;
int nextMove(int R)
{
if(r[cop] - r[R] > 1){
cop = mat[r[cop]-1][c[cop]];
return cop;
}
if(r[R] - r[cop] > 1){
cop = mat[r[cop]+1][c[cop]];
return cop;
}
if(c[cop] - c[R] > 1){
cop = mat[r[cop]][c[cop]-1];
return cop;
}
if(c[R] - c[cop] > 1){
cop = mat[r[cop]][c[cop]+1];
return cop;
}
if(abs(r[R]-r[cop]) == 1 && abs(c[R]-c[cop]) == 1) return cop;
else{
cop = R;
return R;
}
}
# | 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... |