| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 596315 | ibm2006 | Flights (JOI22_flights) | C++17 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Ali.h"
#include <string>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
pair<ll,ll> p[110000];
ll x,y,n,i,j;
void Init(int N, std::vector<int> U, std::vector<int> V) {
  ll i;
  n=N;
  for(i=0;i<N;i++)
    SetID(i,i);
    for(i=0;i<(n-1);i++)
    {
        p[i]={U[i],V[i]};
    }
}
string s;
string SendA(string S) {
  for(i=0;i<(n-1);i++)
  {
      x=p[i].first;
      y=8192;
      for(j=0;j<15;j++)
      {
          if(x/y%2==0)
            s+="0";
          else
            s+="1";
          y/=2;
      }
      y=8192;
      x=p[i].second;
      for(j=0;j<15;j++)
      {
           if(x/y%2==0)
            s+="0";
          else
            s+="1";
          y/=2;
      }
  }
  return s;
}
#include "Benjamin.h"
#include <string>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll x,y,n,k,z,w,h[110000],i,j;
vector<ll> v[110000];
string SendB(int N, int X, int Y) {
  x=X;  y=Y;  n=N;
  return "00000111110000011111";
}
string s;
void f(ll x,ll z)
{
    ll i,w;
    for(i=0;i<h[x];i++)
    {
        if(v[x][i]==z)
            continue;
        w=f(v[x][i],x);
        if(w!=-1)
            return w+1;
    }
    return -1;
}
int Answer(string T) {
  s=T;
  for(i=0;i<(n-1);i++)
  {
      z=0;
      for(j=0;j<15;j++)
      {
          z=z*2+s[i*30+j]-'0';
      }
      w=0;
      for(j=0;j<15;j++)
      {
          w=w*2+s[i*30+15+j]-'0';
      }
      v[z].push_back(w);
      v[w].push_back(z);
  }
  for(i=0;i<n;i++)
    h[i]=v[i].size();
  return f(x,-1);
}
