# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549893 | BalintR | Flights (JOI22_flights) | C++17 | 4000 ms | 7376 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 <vector>
#include <string>
#include <cassert>
#include <iostream>
using namespace std;
#include "Ali.h"
typedef vector<int> vi;
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << arr[_i]; cerr << endl;}
namespace {
const int MN = 1e4;
const int HALF = 100;
int n;
vi adjList[MN];
int dist[MN];
}
void Init(int N, vi U, vi V){
n = N;
FR(i, n-1){
int a = U[i], b = V[i];
adjList[a].pb(b);
adjList[b].pb(a);
}
FR(i, n){
SetID(i, i);
}
}
void dfs(int n1, int par){
dbg(n1);
dbg(par);
for(int n2 : adjList[n1]){
if(n2 != par){
dist[n2] = dist[n1] + 1;
dfs(n2, n1);
}
}
}
string SendA(string inStr){
assert(SZ(inStr) == 20);
int val = 0;
FR(i, 20) val |= (inStr[i]-'0') << i;
int nodeA = val % MN;
int nodeB = val/MN;
dist[nodeA] = 0;
dfs(nodeA, -1);
string res;
FR(i, HALF){
int v = dist[nodeB*HALF + i];
FR(j, 14) res.pb((v >> j) & 1 ? '1' : '0');
}
dbg(nodeA);
dbg(nodeB);
dbgArr(dist, n);
FR(i, n) adjList[i].clear();
return res;
}
#include <string>
using namespace std;
#include "Benjamin.h"
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << arr[_i]; cerr << endl;}
namespace {
const int MN = 1e4;
const int HALF = 100;
int n, x, y;
}
string SendB(int N, int X, int Y){
n = N;
x = X;
y = Y;
int v = x + MN*(y/HALF);
string res;
FR(i, 20) res.pb((v >> i) & 1 ? '1' : '0');
return res;
}
int Answer(string str){
int pos = y % HALF;
int res = 0;
FR(i, 14){
res |= (str[pos*14 + i]-'0') << i;
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |