# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596318 | ibm2006 | Flights (JOI22_flights) | C++17 | 1 ms | 328 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 <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;
ll 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);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |