// Problem: B - Speedrun
// Contest: Virtual Judge - PES segundo examen de práctica febrero 2024
// URL: https://vjudge.net/contest/612265#problem/B
// Memory Limit: 512 MB
// Time Limit: 3500 ms
// Start: 25-02-2024 15:56:28
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define gcd(x, y) __gcd(x, y)
#define mcm(x, y) abs((x) * (y)) / gcd(x, y)
#define all(x) begin(x), end(x)
#define pb(x) push_back(x)
#define endl '\n'
void setHintLen(int l);
void setHint(int i, int j, bool b);
int getLength();
bool getHint(int j);
bool goTo(int x);
void assignHints(int subtask, int N, int A[], int B[]) {
if (subtask != 1) return;
setHintLen(N);
vector<vector<ll>> g(N + 1);
for (int i = 1; i <= N; i++) {
g[A[i]].pb(B[i]);
g[B[i]].pb(A[i]);
}
for (int i = 1; i <= N; i++)
for (ll& nei : g[i]) setHint(i, nei, 1);
}
void speedrun(int substask, int N, int start) {
if (substask != 1) return;
stack<pll> st;
st.push({start, -1});
while (st.size()) {
pll curr = st.top();
st.pop();
goTo(curr.first);
bool added = false;
for (int i = 1; i <= N; i++) {
bool connected = getHint(i);
if (!connected) continue;
if (i == curr.second) continue;
added = true;
st.push({i, curr.first});
}
if (!added && curr.first != start) goTo(curr.second);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
732 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |