# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018836 | Unforgettablepl | Flights (JOI22_flights) | C++17 | 2209 ms | 2740 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;
const int CASES = 48;
namespace {
vector<vector<int>> adj;
int n;
}
void Init(int N, vector<int> U, vector<int> V) {
adj = vector<vector<int>>(N);
n = N;
for(int i=0;i<n-1;i++){
adj[U[i]].emplace_back(V[i]);
adj[V[i]].emplace_back(U[i]);
}
for(int i=0;i<N;i++)SetID(i,i);
}
string SendA(string S) {
int x = 0;
for(int bit=0;bit<20;bit++)if(S[bit]=='1')x|=(1<<bit);
int curr = 0;
int num = 0;
vector<pair<int,int>> possibilities;
for(int l=0;l<n;l++){
for(int r=l+1;r<n;r++){
if(num==CASES){
num = 0;
curr++;
}
num++;
if(curr==x)possibilities.emplace_back(l,r);
}
}
int tar = -1;
function<int(int,int)> dfs = [&](int x,int p){
if(tar==x)return 0;
int ans = 1e5;
for(int&i:adj[x])if(i!=p)ans=min(ans,dfs(i,x)+1);
return ans;
};
string res;
for(auto[a,b]:possibilities){
tar = b;
int ans = dfs(a,-1);
for(int bit=0;bit<14;bit++){
if(ans&(1<<bit))res.insert(res.end(),'1');
else res.insert(res.end(),'0');
}
}
return res;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
const int CASES = 48;
namespace {
int possno;
}
string SendB(int N, int X, int Y) {
int curr = 0;
int num = 0;
int mine = 0;
if(Y<X)swap(X,Y);
vector<pair<int,int>> possibilities;
for(int l=0;l<N;l++){
for(int r=l+1;r<N;r++){
if(num==CASES){
num = 0;
curr++;
}
num++;
if(l==X and r==Y)mine=curr;
}
}
string res;
for(int bit=0;bit<20;bit++){
if(mine&(1<<bit))res.insert(res.end(),'1');
else res.insert(res.end(),'0');
}
curr = 0;
num = 0;
for(int l=0;l<N;l++){
for(int r=l+1;r<N;r++){
if(num==CASES){
num = 0;
curr++;
}
num++;
if(curr==mine)possibilities.emplace_back(l,r);
}
}
for(int i=0;i<possibilities.size();i++){
if(possibilities[i]==make_pair(X,Y))possno=i;
}
return res;
}
int Answer(string T) {
int ans = 0;
for(int bit=0;bit<14;bit++)if(T[possno*14 + bit]=='1')ans|=(1<<bit);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |