Submission #1072087

#TimeUsernameProblemLanguageResultExecution timeMemory
1072087NeroZeinThe Ties That Guide Us (CEOI23_incursion)C++17
12 / 100
277 ms15068 KiB
#include <bits/stdc++.h> #include "incursion.h" using namespace std; vector<int> mark(vector<pair<int, int>> F, int safe) { int n = (int) F.size() + 1; vector<vector<int>> g(n); for (int i = 0; i < n - 1; ++i) { auto [u, v] = F[i]; --u, --v; g[u].push_back(v); g[v].push_back(u); } vector<int> ties(n); function<void(int, int, int)> dfs = [&](int v, int p, int cur) { ties[v] = cur; int nxt = (cur - 1 + 3) % 3; for (int u : g[v]) { if (u != p) { dfs(u, v, nxt); } } }; dfs(safe - 1, safe - 1, 0); return ties; } void locate(vector<pair<int, int>> F, int curr, int t) { int n = (int) F.size() + 1; vector<vector<int>> g(n); for (int i = 0; i < n - 1; ++i) { auto [u, v] = F[i]; --u, --v; g[u].push_back(v); g[v].push_back(u); } function<void(int, int, int)> dfs = [&](int v, int p, int t) { for (int u : g[v]) { if (u == p) { continue; } int new_val = visit(u + 1); if (new_val == (t + 1) % 3) { return dfs(u, v, new_val); } visit(v + 1); } }; dfs(curr - 1, curr - 1, t); }

Compilation message (stderr)

interface.cpp: In function 'int main()':
interface.cpp:44:55: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |     if(fread(T.data(), sizeof(int), 2 * N - 2, stdin) != 2 * N - 2) exit(0);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
interface.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |         int l = (numbers.size() == N ? N : 0);
      |                  ~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...