# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770426 | PoonYaPat | Flights (JOI22_flights) | C++17 | 0 ms | 456 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;
namespace {
vector<int> adj[10001];
int id[10001],n;
int dis[15][10001];
void dfs(int x, int par, int l) {
for (auto s : adj[x]) {
if (s==par) continue;
dis[l][s]=dis[l][x]+1;
dfs(s,x,l);
}
}
}
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) {
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
for (int i=0; i<n; ++i) SetID(i,i);
}
string SendA(std::string S) {
int pow=1,a=0,b=0;
for (int i=0; i<10; ++i) {
if (S[i]=='1') a+=pow;
pow*=2;
}
pow=1;
for (int i=10; i<20; ++i) {
if (S[i]=='1') b+=pow;
pow*=2;
}
vector<int> posA,posB;
for (int i=0; i<n; ++i) {
if (i%1024==a) posA.push_back(i);
if (i%1024==b) posB.push_back(i);
}
string ans="";
for (int i=0; i<posA.size(); ++i) {
dis[i][posA[i]]=0;
dfs(posA[i],-1,i);
for (auto s : posB) {
for (int j=0; j<14; ++j) {
if (dis[i][s]&(1<<j)) ans+="1";
else ans+="0";
}
}
}
return ans;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int XX,YY,NN;
}
string SendB(int N, int X, int Y) {
NN=N;
string ans="";
XX=X; YY=Y;
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(std::string T) {
int xx=XX/1024, yy=YY/1024;
vector<int> posA,posB;
for (int i=0; i<NN; ++i) {
if (i%1024==xx) posA.push_back(i);
if (i%1024==yy) posB.push_back(i);
}
int st=(xx*posB.size()+yy)*14;
cout<<st<<"\n";
int ans=0,pow=1;
for (int i=st; i<st+14; ++i) {
if (T[i]=='1') ans+=pow;
pow*=2;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |