# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896917 | alexander707070 | Flights (JOI22_flights) | C++17 | 951 ms | 4296 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<bits/stdc++.h>
#include "Ali.h"
#define MAXN 100007
using namespace std;
namespace{
int n,xx,yy;
vector<int> v[MAXN],w;
int dist[MAXN];
string res;
bool vis[MAXN];
void dfs(int x,int p,int d){
dist[x]=d;
vis[x]=true;
for(int i=0;i<v[x].size();i++){
if(v[x][i]==p or vis[v[x][i]])continue;
dfs(v[x][i],x,d+1);
}
}
}
void Init(int N, vector<int> U, vector<int> V){
double st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
n=N;
for(int i=0;i<n;i++)v[i].clear();
w.clear();
for(int i=0;i<n-1;i++){
v[U[i]].push_back(V[i]);
v[V[i]].push_back(U[i]);
}
for(int i=0;i<=n-1;i++){
SetID(i,i);
}
}
string SendA(string S){
double st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.05){
break;
}
}
xx=yy=0;
res="";
for(int i=0;i<14;i++){
xx*=2;
if(S[i]=='1')xx++;
}
/*
for(int i=0;i<6;i++){
yy*=2;
if(S[14+i]=='1')yy++;
}
for(int i=0;i<8;i++)yy*=2;*/
for(int i=0;i<=n-1;i++){
if(xx==i)continue;
//if((i^yy)>=(1<<8))continue;
w.push_back(i);
}
st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
if(xx>=n)cout<<1/0;
dfs(xx,-1,0);
st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
for(int curr:w){
for(int i=13;i>=0;i--){
if(((1<<i)&curr)>0)res+="1";
else res+="0";
}
for(int i=13;i>=0;i--){
if(((1<<i)&dist[curr])>0)res+="1";
else res+="0";
}
}
return res;
}
#include<bits/stdc++.h>
#include "Benjamin.h"
#define MAXN 100007
using namespace std;
namespace{
int nn,from,to,s;
string res;
}
string SendB(int N, int X, int Y){
double st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.2){
break;
}
}
nn=N; from=X; to=Y;
st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
res="";
for(int i=13;i>=0;i--){
if((from&(1<<i))==0)res+="0";
else res+="1";
}
st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
for(int i=13;i>=8;i--){
if((to&(1<<i))==0)res.push_back('0');
else res.push_back('1');
}
st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
return res;
st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
}
int Answer(string T){
double st=clock();
while(true){
double et=clock();
if((et-st)/CLOCKS_PER_SEC>0.1){
break;
}
}
if(int(T.size())%28!=0)cout<<1/0;
for(int i=0;i<T.size();i+=28){
s=0;
for(int f=i;f<i+14;f++){
s*=2;
if(f>=T.size())cout<<1/0;
if(T[f]=='1')s++;
}
if(s==to){
s=0;
for(int f=i+14;f<i+28;f++){
s*=2;
if(f>=T.size())cout<<1/0;
if(T[f]=='1')s++;
}
return s;
}
}
cout<<1/0;
return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |