| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1004024 | edogawa_something | Flights (JOI22_flights) | C++17 | 314 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;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first 
#define S second 
#define all(v) v.begin(),v.end()
#define pb push_back
const int M=10001;
const ll inf=1e9+10;
vii adj[M];
ll id[M];
ll t=0;
ll n;
void dfs(ll x,ll pa){
  id[x]=t++;
  for(auto it:adj[x]){
    if(it==pa)
    continue;
    dfs(it,x);
  }
}
string res;
void ord(ll x,ll pa){
  for(auto it:adj[x]){
    if(it==pa)
    continue;
    res.pb('1');
    ord(it,x);
  }
  if(pa>=0)
  res.pb('0');
}
void Init(int N, std::vector<int> U, std::vector<int> V) {
  n=N;
  for(int i=0;i<n-1;i++)
  adj[U[i]].pb(V[i]),adj[V[i]].pb(U[i]);
  dfs(0,-1);
  for(int i=0;i<n;i++)
  SetID(i,id[i]);
}
std::string SendA(std::string S){
  ord(0,-1);
  return res;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first 
#define S second 
#define all(v) v.begin(),v.end()
#define pb push_back
namespace {
  const ll M=1e5;
  const ll inf=1e18;
  ll n,x,y,pa[M],dis[M];
  vii adj[M];
  void dfs(ll x,ll pa=-1,ll d=0){
    dis[x]=d;
    for(auto it:adj[x]){
      if(it==pa)
      continue;
      dfs(it,x,d+1);
    }
  }
}
std::string SendB(int N, int X, int Y) {
  n=N,x=X,y=Y;
  string r;
  for(int i=0;i<20;i++)
  r.pb('0');
  return r;
}
int Answer(std::string T) {
  ll t=0;
  ll cur=0;
  for(auto it:T){
    if(it=='1'){
    pa[++t]=cur;
    cur=t;
    }
    else{
      cur=pa[cur];
    }
  }
  for(int i=1;i<=t;i++)
  adj[i].pb(pa[i]),adj[pa[i]].pb(i);
  dfs(x);
  return dis[y];
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
