# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
567770 | jamezzz | Flights (JOI22_flights) | C++17 | 6 ms | 1092 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;
namespace {
int nn;
int dist[10005];
vector<int> AL[10005];
void dfs(int u){
for(int v:AL[u]){
if(dist[v]!=-1)continue;
dist[v]=dist[u]+1;
dfs(v);
}
}
}
void Init(int N, vector<int> U, vector<int> V){
nn=N;
for(int i=0;i<N;++i){
AL[i].clear();
}
memset(dist,-1,sizeof dist);
for(int i=0;i<N-1;++i){
AL[U[i]].push_back(V[i]);
AL[V[i]].push_back(U[i]);
}
for(int i=0;i<N;++i)SetID(i,i);
}
string SendA(string S){
int X=0,Y=0;
for(int i=0;i<14;++i){
if(S[i]=='1')X+=(1<<i);
}
for(int i=0;i<6;++i){
if(S[i+14]=='1')Y+=(1<<i);
}
dist[X]=0;dfs(X);
string ret;
for(int i=0;i<=nn/64;++i){
int u=64*i+Y;
for(int i=0;i<14;++i){
if((dist[u]&(1<<i))!=0)ret+='1';
else ret+='0';
}
}
return ret;
}
#include "Benjamin.h"
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int yy;
}
string SendB(int N, int X, int Y){
yy=Y;
string s;
for(int i=0;i<14;++i){
if((X&(1<<i))!=0)s+='1';
else s+='0';
}
for(int i=0;i<6;++i){
if((Y&(1<<i))!=0)s+='1';
else s+='0';
}
return s;
}
int Answer(string T){
yy/=64;
int ans=0;
for(int i=yy*14;i<(yy+1)*14;++i){
if(T[i]=='1')ans+=(1<<i);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |