Submission #1269318

#TimeUsernameProblemLanguageResultExecution timeMemory
1269318sula2Migrations (IOI25_migrations)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> adj[10000]; int X = 0, Y = 0; pair<int,int> dfs(int u, int p = -1) { pair<int,int> res = {0, u}; for (int v : adj[u]) { auto z = dfs(v, u); z.first++; res = max(res, z); } return p; } int send_message(int N, int i, int Pi) { adj[i].push_back(Pi); adj[Pi].push_back(i); int nX = 0, nY = 0; if (i >= N-3) { nX = dfs(0).second; nY = dfs(0).second; } int res = 0; if (i < N-2) goto NOTHING; if (i == N-2) res = X; else { res = i == nX ? Y + N : Y; } NOTHING: X = nX, Y = nY; return res; } pair<int,int> longest_path(std::vector<int> S) { int n = S.size(); int u = S[n-2]; int v = S[n-2]; if (v >= n) { u = v - n; v = n-1; } return {u, v}; }

Compilation message (stderr)

migrations.cpp: In function 'std::pair<int, int> dfs(int, int)':
migrations.cpp:14:12: error: could not convert 'p' from 'int' to 'std::pair<int, int>'
   14 |     return p;
      |            ^
      |            |
      |            int