# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022575 | manizare | Library (JOI18_library) | C++14 | 0 ms | 0 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>
#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define pii pair <int,int>
#define PII pair<pii , pii>
#define ld long double
#define int long long
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= b;i++)
#define per(i, a , b) for(int i=a;i >= b;i--)
using namespace std ;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 2000 + 10 , sq = 550, inf = 1e8+10 , mod = 10007 , lg = 20 ;
int nx[maxn] , n , mark[maxn] ;
void
int q2(vector <int> vec){
rep(i ,1, n)mark[i] = 0 ;
while(sz(vec)){
int v = vec.back() ;vec.pop_back() ;
while(1){
mark[v] = 1;
if(nx[v] == 0)break;
v = nx[v] ;
}
}
return que() ;
}
int find(vector <int> vec , int x){
if(sz(vec) == 1){
return vec[0] ;
}
vector <int> a ;
rep(i ,0 ,sz(vec)/2-1){
a.pb(vec[i]) ;
}
a.pb(x) ;
if(q2(a)==sz(a)){
vector <int> b ;
rep(i , sz(vec)/2 , sz(vec)-1){
b.pb(vec[i]) ;
}
return find(b , x) ;
}
a.pop_back() ;
return find(a , x) ;
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n ;
rep(i ,1 , n){
cin
}
}
/*
*/