# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
887574 | Ahmed57 | Flights (JOI22_flights) | C++17 | 34 ms | 3904 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;
int target , ans = 0;
vector<int> adj[100001];
void dfs(int i,int pr,int dep){
if(i==target){
ans = dep;
}
for(auto j:adj[i]){
if(j==pr)continue;
dfs(j,i,dep+1);
}
}
int n = 0;
void Init(int N, std::vector<int> U, std::vector<int> V){
n = N;
for(int i = 0;i<N;i++){
adj[i].clear();
}
for(int i = 0;i<N-1;i++){
int a = U[i] , b = V[i];
adj[a].push_back(b);
adj[b].push_back(a);
}
for(int i = 0;i<n;i++){
SetID(i,i);
}
}
string SendA(string S){
int x = 0 , y = 0;
for(int i = 0;i<10;i++){
if(S[i]=='1')x^=(1<<i);
}
for(int i = 10;i<20;i++){
if(S[i]=='1')y^=(1<<(i-10));
}
int cnt = 0;
string lol;
for(int i = 0;i<16;i++){
for(int j = 0;j<16;j++){
int nx = (x|(i<<10)) , ny = (y|(j<<10));
if(nx>=n||ny>=n){
for(int e = cnt;e<cnt+14;e++){
lol+='0';
}
}else{
target = ny;
dfs(nx,nx,0);
for(int e = cnt;e<cnt+14;e++){
if(ans&(1<<(e-cnt)))lol+='1';
else lol+='0';
}
}
cnt+=14;
}
}
return lol;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
int x , y;
string SendB(int N, int X, int Y){
x = X, y = Y;
x>>=10;
y>>=10;
string ans;
for(int i = 0;i<10;i++){
if(X&(1<<i))ans+='1';
else ans+='0';
}for(int i = 0;i<10;i++){
if(Y&(1<<i))ans+='1';
else ans+='0';
}
return ans;
}
int Answer(string T){
int cnt = 0;
long long ans = 0;
for(int i = 0;i<16;i++){
for(int j = 0;j<16;j++){
if(i==x&&j==y){
for(int e = cnt;e<cnt+14;e++){
if(T[e]=='1')ans|=(1<<(e-cnt));
}
}else cnt+=14;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |