# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103094 | underwaterkillerwhale | Kangaroo (CEOI16_kangaroo) | C++17 | 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>
#define ll long long
#define rep(i,m,n) for(int i=(m); i<=(n); i++)
#define reb(i,m,n) for(int i=(m); i>=(n); i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair
#define fs first
#define se second
#define bit(msk, i) ((msk >> i) & 1)
#define iter(id, v) for(auto id : v)
#define pb push_back
#define SZ(v) (ll)v.size()
#define ALL(v) v.begin(),v.end()
using namespace std;
mt19937_64 rd(chrono :: steady_clock :: now ().time_since_epoch().count());
ll Rand (ll l, ll r) { return uniform_int_distribution<ll> (l, r) (rd); }
const int N = 2e5 + 7;
const int Mod = 1e9 + 7;///lon
const int INF = 1e9;
const ll BASE = 137;
const int szBL = 450;
int n, K;
int a[N];
int sos[(1 << 20) + 7];
void solution () {
cin >> n;
rep (i, 1, n) {
cin >> a[i];
}
rep (i, 1, n)
rep (j, 1, n) {
sos[a[i] & a[j]]++;
}
rep (i, 0, 19)
rep (msk, 0, (1 << 20) - 1)
if (!bit(msk, i))
sos[msk] += sos[msk ^ (1 << i)];
int A, B, C, D;
rep (i, 1, n)
rep (j, 1, n) {
if (sos[a[i] & a[j]] < K) {
K -= sos[a[i] & a[j]];
}
else {
A = i, B = j;
break;
}
}
rep (msk, ())
rep (i, 1, n)
sos[a[i]]++;
rep (i, 0, 19)
rep (msk, 0, (1 << 20) - 1)
if (!bit(msk, i))
sos[msk] += sos[msk ^ (1 << i)];
}
#define file(name) freopen(name".inp","r",stdin); \
freopen(name".out","w",stdout);
int main () {
// file("c");
ios_base :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
int num_Test = 1;
// cin >> num_Test;
while (num_Test--)
solution();
}
/*
no bug challenge +11
7 9
1 5 3 4 8 3 2
7 4 8 3 2 3 1
ko gan gtri bien co the cut
bien doi operation update doan thanh update phan tu tren mang hieu de de quan sat mo hinh bai toan hon
*/