이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <array>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <list>
#include <iterator>
#include <numeric>
#include <complex>
#include <utility>
#include <random>
#include <cassert>
#include <fstream>
#include "coprobber.h"
using namespace std;
mt19937 rnd(7069);
/* -------------------- Typedefs -------------------- */
typedef int itn;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef float fl;
typedef long double ld;
/* -------------------- Usings -------------------- */
using vi = vector<int>;
using vll = vector<ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
/* -------------------- Defines -------------------- */
#define ff first
#define ss second
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mpr make_pair
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define all(x) (x).begin(), (x).end()
#define USACO freopen("feast.in", "r", stdin); freopen("feast.out", "w", stdout);
/* -------------------- Constants -------------------- */
const int dx[8] = { -1, 0, 1, 0, -1, -1, 1, 1 };
const int dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };
const int MAX = int(1e9 + 5);
const ll MAXL = ll(1e18) + 5ll;
const ll MOD = ll(1000000007);
const ll MOD2 = ll(998244353);
const int N = 505;
vi g[N];
int dist[N][N];
int n, cur;
void bfs(int s) {
queue<int> q;
vi used(n);
used[s] = 1;
q.push(s);
while (!q.empty()) {
int u = q.front();
q.pop();
for (auto to : g[u]) {
if (!used[to]) {
dist[s][to] = dist[s][u] + 1;
used[to] = 1;
q.push(to);
}
}
}
}
int start(int N, bool A[MAX_N][MAX_N]) {
n = N;
cur = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (!A[i][j]) continue;
g[i].pub(j);
}
}
for (int i = 0; i < n; ++i) bfs(i);
return 0;
}
int nextMove(int R) {
int r = R;
int d = dist[cur][r];
for (auto to : g[cur]) {
if (dist[to][r] == d - 1) {
cur = to;
return to;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:115:1: warning: control reaches end of non-void function [-Wreturn-type]
115 | }
| ^
# | 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... |