# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1122459 | hengliao | Bitaro’s Party (JOI18_bitaro) | C++17 | 675 ms | 112916 KiB |
#include <bits/stdc++.h>
using namespace std;
const int SQ = 100; // cutoff for sqrt decomp
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m, q;
cin >> n >> m >> q;
vector<vector<int>> rg(n);
for (int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
rg[--v].push_back(--u);
}
int test=0;
// stores the 100 longest paths ending at i
vector<vector<pair<int, int>>> path_sizes(n);
vector<int> from(n, -1); // longest path starting at that node
for (int i = 0; i < n; i++) {
path_sizes[i].push_back({0, i});
vector<int> from_indicies;
for (int j : rg[i]) {
for (auto [dist, idx] : path_sizes[j]) {
if (from[idx] == -1) {
// if we haven't gotten a path from this index yet
from_indicies.push_back(idx);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |