// compile: make data
// run: ./data < data.in
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#ifdef LOCAL
#include <debug/codeforces.h>
#define debug(x...) _debug_print(#x, x);
#define Debug(x...) _debug_print_format(#x, x);
std::ifstream terminal("/dev/tty");
#define PP cerr<<"\033[1;30mpause...\e[0m",terminal.ignore();
#else
#define debug(x...)
#define Debug(x...)
#define PP
#endif
template<typename...Args> void print_(Args...args){((cout<<args<<" "),...)<<endl;}
#define rep(i,a,b) for(int i=(a);i<(int)(b);++i)
#define sz(v) ((int)(v).size())
#define print(...) print_(__VA_ARGS__);
#define FIND(a, x) ((find(a.begin(),a.end(),(x))!=a.end())?1:0)
#define cmin(x,...) x=min({(x),__VA_ARGS__})
#define cmax(x,...) x=max({(x),__VA_ARGS__})
#define INTMAX (int)(9223372036854775807)
#define INF (int)(1152921504606846976)
#define NaN (int)(0x8b88e1d0595d51d1)
#define double long double
#define int long long
#define uint unsigned long long
#define MAXN 200010
int32_t main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
tree<pair<int, int>, null_type, decltype([](pair<int, int> A, pair<int, int> B) {return (A.second < B.second) || (A.second == B.second && A.first < B.first); }), rb_tree_tag, tree_order_statistics_node_update> s1, s2;
int n; cin >> n;
vector<pair<pair<int, int>, int>> a(n);
rep(i, 0, n) {
cin >> a[i].first.first >> a[i].first.second;
a[i].second = i;
s1.insert({a[i].first.first, a[i].first.second});
}
sort(a.begin(), a.end());
vector<int> res1(n), res2(n);
for (int pre = 0, i = 0; i < n; ++i) {
res1[a[i].second] = s1.order_of_key({INF, a[i].first.second}) - 1;
if (i == n-1 || a[i].first.first == a[i+1].first.first) continue;
rep(j, pre, i+1) s1.erase({a[j].first.first, a[j].first.second});
pre = i+1;
}
for (int lst = 0, i = 0; i < n; ++i) {
if (i >= lst) {
s2.insert({a[i].first.first, a[i].first.second});
for (++lst; (lst < n) && (a[lst].first.first == a[lst-1].first.first); ++lst) s2.insert({a[lst].first.first, a[lst].first.second});
}
res2[a[i].second] = sz(s2) - s2.order_of_key({-INF, a[i].first.second}) - 1;
}
rep(i, 0, n) printf("%lld%c", res1[i] ? 1 : 0, " \n"[i==n-1]);
rep(i, 0, n) printf("%lld%c", res2[i] ? 1 : 0, " \n"[i==n-1]);
return 0;
}
Heard some whispers about Kulisbetaffiliate. If you’re interested in affiliates, this might be worth a look. Seems like they have some decent programs. Find out more here: kulisbetaffiliate
23winslot? Name kinda speaks for itself, right? Slots galore! Some of them are surprisingly fun, and payouts aren’t terrible. Worth a spin or two, I reckon. More info here: 23winslot
Yo, tried the b29betapk.org app. Installation was a breeze, and performance is solid. Perfect for betting on the go! Download it if you’re always on the move. Here’s the link: b29betapk
Brapud is legit, I used it the other day. Everything went super fine: brapud
Alright folks, h2betcasino is what it is. Selection is…there. Won some, lost some. Same old story. Worth a look if you’re hunting. h2betcasino
I found 68jlcasino to be a pretty standard online casino. Had some okay wins. Maybe give it a try if you want a safe bet! 68jlcasino
Registering was a breeze and I started playing in less than two minutes. The bonuses for new players are actually worth it. aurahokidaftar is legit
The excitement here is on another level. I love how diverse the game library is. I will definitely keep coming back to bet2888game.
The app version is so much better than the browser. It’s snappy and works perfectly on my phone. You guys should definitely download l444apk.
I’ve been using this platform for a while now and the experience is just smooth. Definitely one of the best choices for gaming. Check out pkbaij999 for more info.
This place has a great vibe and the game selection is top notch. I love the daily rewards and the community feel of the platform. Join the fun at jilibaycasino
I recently stumbled upon this hidden gem and I am so glad I stuck around for the amazing promotions and quick replies from the support crew. It really takes the stress out of online gaming and turns every session into a pure joyride. You should definitely drop by and see the difference h5777login
I really appreciate the customer support here, they answered my questions in minutes. Great vibes and great games at damaibetslot.