# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1058876 | AlphaBruh | Longest Trip (IOI23_longesttrip) | C++17 | 11 ms | 764 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 "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;
//bool are_connected(std::vector<int> A, std::vector<int> B);
vector<int>A;
vector<int>B;
int al;
int fA(int l, int r, int s=0){
if(l==r){
if(s) return l;
if(are_connected({A[l]},B)) return l;
return -1;
}
int md=(l+r)>>1;
vector<int>check;
for(int i=l;i<=md;i++) check.push_back(A[i]);
if(are_connected(check,B)) return fA(l,md,1);
return fA(md+1,r,s);
}
int fB(int l, int r){
if(l==r) return l;
int md=(l+r)>>1;
vector<int>check;
for(int i=l;i<=md;i++) check.push_back(B[i]);
if(are_connected(check,{A[al]})) return fB(l,md);
return fB(md+1,r);
}
std::vector<int> longest_trip(int N, int D)
{
deque<int>a;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |