# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062382 | thinknoexit | Flights (JOI22_flights) | C++17 | 344 ms | 540672 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;
using ll = long long;
namespace {
vector<int> adj[10010];
int dis[10010], n;
};
void dfs(int v, int p = -1) {
for (auto& x : adj[v]) {
if (x == p) continue;
dis[x] = dis[v] + 1;
dfs(x, v);
}
}
void Init(int __N, vector<int> U, vector<int> V) {
n = __N;
for (int i = 0;i < n - 1;i++) {
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
for (int i = 0;i < n;i++) SetID(i, i);
}
string SendA(string S) {
// first 14 bit of S is X
// last 6 bit of S is Y (partial)
int X = 0;
for (int i = 0;i < 14;i++) X ^= ((S[i] - '0') << i);
int Y = 0;
for (int i = 14;i < 20;i++) Y ^= ((S[i] - '0') << (i - 14));
dfs(X);
string res = "";
for (int i = 0;i < n;i++) {
if ((i & 63) != Y) continue;
for (int j = 0;j < 14;j++) res += ((dis[i] >> j) & 1) + '0';
}
return res;
}
#include "Benjamin.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
namespace {
int n, Y;
}
string SendB(int __N, int X, int Y) {
n = __N;
string res = "";
for (int i = 0;i < 14;i++) {
res += ((X >> i) & 1) + '0';
}
for (int i = 14;i < 20;i++) {
res += ((Y >> (i - 14)) & 1) + '0';
}
::Y = Y;
return res;
}
int Answer(string T) {
int s = 0;
for (int i = 0;i < n;i++) {
if ((i & 63) != (Y & 63)) continue;
if (i == Y) {
int ans = 0;
for (int j = s;j < s + 14;j++) {
ans ^= ((T[j] - '0') << (j - s));
}
return ans;
}
s += 14;
}
return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |