Submission #1255060

#TimeUsernameProblemLanguageResultExecution timeMemory
1255060vpinxMigrations (IOI25_migrations)C++20
Compilation error
0 ms0 KiB
#include "migrations" #include <bits/stdc++.h> using namespace std; vector<vector<int>> adj; int send_message(int n, int i, int pi) { if (i == 1) adj.resize(n); adj[i].push_back(pi); adj[pi].push_back(i); if (i < n - 1) return 0; vector<bool> vis(n, false); vis[0] = true; stack<pair<int, int>> s; s.push({0, 0}); int message, int ans = -1; while (!s.empty()) { auto [at, d] = s.top(); s.pop(); if (d > ans) ans = d, message = at; for (int to : adj[at]) { if (!vis[to]) { vis[to] = true; s.push({to, d + 1}); } } } return message; } pair<int, int> longest_path(vector<int> s) { return {0, s[s.size() - 1]}; }

Compilation message (stderr)

migrations.cpp: In function 'int send_message(int, int, int)':
migrations.cpp:19:18: error: expected unqualified-id before 'int'
   19 |     int message, int ans = -1;
      |                  ^~~
migrations.cpp:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         if (d > ans) ans = d, message = at;
      |                 ^~~
      |                 abs