| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1324745 | askeww | Tales of seafaring (POI13_mor) | C++20 | 2632 ms | 196608 KiB |
#include <bits/stdc++.h>
using namespace std;
template<typename T>
using V = vector<T>;
using pi = pair<int, int>;
int n, m, k, u, v, c;
V<V<int>> adj;
V<V<V<int>>> d;
int main() {
cin >> n >> m >> k;
adj = V<V<int>>(n + 1);
for (int i = 1; i <= m; i++) {
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
d = V<V<V<int>>>(n + 1, V<V<int>>(2, V<int>(n + 1, -1)));
for (int i = 1; i <= n; i++) {
queue<pi> q;
q.push({i, 0});
while (!q.empty()) {
pi x = q.front();
q.pop();
if (d[i][x.second % 2][x.first] != -1) continue;
d[i][x.second % 2][x.first] = x.second;
for (auto& it : adj[x.first]) {
q.push({it, x.second + 1});
}
}
}
while (k--) {
cin >> u >> v >> c;
if (u == v) {
if (adj[u].empty()) {
cout << "NIE" << endl;
continue;
}
}
if (d[u][c % 2][v] == -1) {
cout << "NIE" << endl;
continue;
}
if (d[u][c % 2][v] <= c) {
cout << "TAK" << endl;
} else {
cout << "NIE" << endl;
}
}
}| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
