General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
87212507 Practice:
Prajwal_
1285D - 23 C++14 (GCC 6-32) Accepted 280 ms 61652 KB 2020-07-18 11:56:25 2020-07-18 11:56:25
→ Source
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define digits(x) floor(log10(x) + 1)
#define countbits(x) ((int)log2(x)+1)
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define init(arr,value) memset(arr,value,sizeof(arr))
#define deb(x) cout << #x << "=" << x << endl;
#define test unsigned int tet;cin >> tet;while(tet--)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const ll N   = 500500;

int func(vector<int> a, int b)
{
    if(b == -1) return 0;
    int n = a.size();
    vector<int> v[2];
    for(int i=0; i<n; i++){
        v[((1LL<<b)&a[i]) == 0].pb(a[i]);
    }
    if(v[0].size() == 0 || v[1].size() == 0){
        return func(a,b-1);
    }
    else{
        return (1LL<<b) + min(func(v[0],b-1), func(v[1],b-1));
    }
}

signed main(void)
{
    	fastio
        int n;
        cin >> n;
        vector<int> a(n);
        for(auto &x : a) cin >> x;

        cout << func(a,30) << endl;

    	return 0;
}

?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details