/*
-A2 --indent=tab=4 --indent-classes --indent-switches --indent-namespaces --indent-preprocessor -xg -p -xd -H -xj -xe
read all problems
do first-eye problems
read rev order
uhhh dont fail impl
*/
#include <bits/stdc++.h>
#define double long double
#define re(a, b, c, d) for (auto a = b; a <= c; a += d)
#define de(a, b, c, d) for (auto a = b; a >= c; a -= d)
#define ms(a, b) memset(a, b, sizeof (a))
#define imax INT_MAX
#define imin INT_MIN
#define wh(a) while (a --)
#define PII pair <int, int>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#include"worldmap.h"
template <typename T> bool chkmin (T &a, T b) {
return (b < a) ? a = b, 1 : 0;
}
template <typename T> bool chkmax (T &a, T b) {
return (b > a) ? a = b, 1 : 0;
}
using namespace std;
vector <vector <int> > create_map (int n, int m, vector <int> U, vector <int> V) {
vector <int> vs (n + 1), d (n + 1), pos (n + 1);
vector <vector <int> > G (n + 1), H (n + 1);
re (i, 0, m - 1, 1) G[U[i]].eb (V[i]), G[V[i]].eb (U[i]);
vector <int> E;
function <void (int, int)> dfs = [&] (int u, int fa) {
vs[u] = 1, E.eb (u), pos[u] = E.size(), E.eb (u), E.eb (u);
for (int v : G[u]) if (v != fa)
if (!vs[v]) d[v] = d[u] + 1, dfs (v, u), E.eb (u);
else if (d[v] < d[u]) H[u].eb (v);
};
dfs (1, 0);
vector <vector <int> > ans (n + n, vector <int> (n + n));
re (i, 0, n + n - 1, 1) re (j, 0, n + n - 1, 1) ans[i][j] = E[i + j];
re (i, 1, n, 1) {
int k = max (0, pos[i] - n - n + 1);
for (int j : H[i]) ans[k][pos[i] - k] = j, k ++;
}
return ans;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |