# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
567835 | zaneyu | Flights (JOI22_flights) | C++17 | 16 ms | 12524 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;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-6;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<P.f<<' '<<P.s;
return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
REP(i,sz(V)) out<<V[i]<<((i!=sz(V)-1)?" ":"");
return out;
}
namespace {
int variable_example = 0;
}
vector<int> v[maxn];
int n;
void Init(int N, std::vector<int> U, std::vector<int> V) {
n=N;
REP(i,n) v[i].clear();
REP(i,n-1){
v[U[i]].pb(V[i]);
v[V[i]].pb(U[i]);
}
REP(i,n) SetID(i,i);
}
int dep[maxn];
void dfs(int u,int p){
//cout<<u<<' '<<dep[u]<<'\n';
for(int x:v[u]){
if(x==p) continue;
dep[x]=dep[u]+1;
dfs(x,u);
}
}
std::string SendA(std::string S) {
int x=0;
REP(i,14){
x=(x*2)+(S[i]-'0');
}
int y=0;
REP(i,6){
y=(y*2)+(S[i]-'0');
}
//cout<<x<<' '<<y<<'\n';
dep[x]=0;
dfs(x,-1);
string ans="";
REP(i,n){
if((i>>8)==y){
REP(j,14){
bool z=(dep[i]&(1<<(13-j)));
ans.pb('0'+z);
}
}
}
return ans;
}
#include "Benjamin.h"
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-6;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<P.f<<' '<<P.s;
return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
REP(i,sz(V)) out<<V[i]<<((i!=sz(V)-1)?" ":"");
return out;
}
namespace {
int variable_example = 0;
}
int nn,y;
std::string SendB(int N, int X, int Y) {
nn=N,y=Y;
string ans="";
REP(i,14){
bool a=(X&(1<<(13-i)));
ans.pb('0'+a);
}
REP(i,6){
bool a=(Y&(1<<(13-i)));
ans.pb('0'+a);
}
return ans;
}
int Answer(std::string T) {
vector<int> v;
REP(i,nn){
if((i>>8)==(y>>8)){
v.pb(i);
}
}
int pos=(find(ALL(v),y)-v.begin());
int ans=0;
REP(j,14){
ans=ans*2+(T[pos*14+j]-'0');
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |