# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062311 | kunzaZa183 | Flights (JOI22_flights) | C++17 | 4 ms | 1068 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Ali.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
vector<vector<int>> adjlist;
} // namespace
void Init(int N, vector<int> U, vector<int> V) {
for (int i = 0; i < N; i++)
SetID(i, i);
adjlist.clear();
adjlist.resize(N);
for (int i = 0; i < N - 1; i++) {
adjlist[U[i]].push_back(V[i]), adjlist[V[i]].push_back(U[i]);
}
}
string SendA(string S) {
auto decode = [&](string S) {
int cur = 0;
for (auto a : S) {
cur *= 2;
cur += a - '0';
}
return cur;
};
int a = decode(S.substr(0, 10)), b = decode(S.substr(10, 10));
int ans;
function<void(int, int, int, int)> dfs = [&](int cur, int par, int len,
int target) {
if (cur == target) {
ans = len;
return;
}
for (auto a : adjlist[cur])
if (a != par)
dfs(a, cur, len + 1, target);
};
dfs(a, a, 0, b);
auto base2 = [](int cur) {
string tmp = "";
for (int i = 0; i < 10; i++) {
tmp.push_back('0' + cur % 2);
cur /= 2;
}
reverse(tmp.begin(), tmp.end());
return tmp;
};
return base2(ans);
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
} // namespace
string SendB(int N, int X, int Y) {
auto base2 = [](int cur) {
string tmp = "";
for (int i = 0; i < 10; i++) {
tmp.push_back('0' + cur % 2);
cur /= 2;
}
reverse(tmp.begin(), tmp.end());
return tmp;
};
string s1 = base2(X), s2 = base2(Y);
return s1 + s2;
}
int Answer(string T) {
auto decode = [&](string S) {
int cur = 0;
for (auto a : S) {
cur *= 2;
cur += a - '0';
}
return cur;
};
return decode(T);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |