# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
567909 | zaneyu | Flights (JOI22_flights) | C++17 | 426 ms | 13580 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,10){
x=(x*2)+(S[i]-'0');
}
int y=0;
REP(i,10){
y=(y*2)+(S[i+10]-'0');
}
vector<int> vv;
vector<vector<int>> tmp;
REP(i,n){
if(i%1024==x){
vector<int> dst;
dep[i]=0;
dfs(i,-1);
REP(a,n) dst.pb(dep[a]);
tmp.pb(dst);
vv.pb(i);
}
}
string ans="";
REP(i,n){
if(i%1024==y){
REP(j,sz(vv)){
if(vv[j]>=i) break;
int d=tmp[j][i];
REP(j,14){
bool z=(d&(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 n,x,y;
}
std::string SendB(int N, int X, int Y) {
if(X>Y) swap(X,Y);
n=N,x=X,y=Y;
string ans="";
REP(i,10){
bool a=(X&(1<<(9-i)));
ans.pb('0'+a);
}
REP(i,10){
bool a=(Y&(1<<(9-i)));
ans.pb('0'+a);
}
return ans;
}
int Answer(std::string T) {
vector<int> v1,v2;
REP(i,n) if(i%1024==x%1024) v1.pb(i);
REP(i,n) if(i%1024==y%1024) v2.pb(i);
int c=0;
for(int a:v2){
for(int b:v1){
if(b>=a) break;
if(b==x and a==y){
int ans=0;
REP(j,14){
ans=ans*2+(T[c*14+j]-'0');
}
return ans;
}
++c;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |