# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770412 | 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;
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;
}
}
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') a+=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) {
//consider dis[i][s]
for (int i=0; i<14; ++i) {
if (dis[i][s]&(1<<i)) ans+="1";
else ans+="0";
}
}
}
return ans;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
int x,y,n;
string SendB(int N, int X, int Y) {
n=N;
string ans="";
x=X; y=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 dis[11][11];
int Answer(std::string T) {
int xx=x%1024, yy=y%1024;
vector<int> posA,posB;
for (int i=0; i<n; ++i) {
if (i%1024==xx) posA.push_back(i);
if (i%1024==yy) posB.push_back(i);
}
int st=((xx-1)*posB.size()+yy)*14;
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... |