# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062410 | kunzaZa183 | Flights (JOI22_flights) | C++17 | 225 ms | 2704 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;
auto decode = [](string S) {
int cur = 0;
for (auto a : S) {
cur *= 2;
cur += a - '0';
}
return cur;
};
auto base2 = [](int cur, int len) {
string tmp = "";
for (int i = 0; i < len; i++) {
tmp.push_back('0' + cur % 2);
cur /= 2;
}
reverse(tmp.begin(), tmp.end());
return tmp;
};
int N;
} // namespace
void Init(int N, vector<int> U, vector<int> V) {
::N = N;
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) {
int val = decode(S);
int from = val / 100, rem = val % 100;
// cerr << from << ' ' << rem << "\n";
vector<int> dis(N);
function<void(int, int, int)> dfs = [&](int cur, int par, int len) {
dis[cur] = len;
for (auto a : adjlist[cur])
if (a != par)
dfs(a, cur, len + 1);
};
dfs(from, from, 0);
// for (auto a : dis)
// cout << a << " ";
// cout << "\n";
string tmp;
for (int i = rem * 100; i < rem * 100 + 100 && i < N; i++)
tmp += base2(dis[i], 14);
// cerr << tmp << "\n";
return tmp;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
auto decode = [](string S) {
int cur = 0;
for (auto a : S) {
cur *= 2;
cur += a - '0';
}
return cur;
};
auto base2 = [](int cur, int len) {
string tmp = "";
for (int i = 0; i < len; i++) {
tmp.push_back('0' + cur % 2);
cur /= 2;
}
reverse(tmp.begin(), tmp.end());
return tmp;
};
const int maxsend = 1e2;
int X, Y;
} // namespace
string SendB(int N, int X, int Y) {
::X = X, ::Y = Y;
// cerr << X << " " << Y << "\n";
int val = X * maxsend + Y / maxsend % maxsend;
return base2(val, 20);
}
int Answer(string T) {
int in = Y % maxsend;
return decode(T.substr(in * 14, 14));
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |