# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
886597 | vjudge1 | Towers (NOI22_towers) | C++17 | 597 ms | 54100 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 int long long int
#define MP make_pair
#define REP(i,n) for(int (i) = 0; (i)<(n); (i)++)
#define pb push_back
const int N = 1e6+5;
const int MOD = 1e9+7;
const int INF = 1e17;
using namespace std;
void fastio() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
}
int n,m,q;
struct Point {
int x,y,id;
Point() : x(0), y(0) {};
Point(int xc, int yc) : x(xc), y(yc) {};
void input(int ind) {
id = ind;
cin>>x>>y;
}
bool operator<(const Point &oth) {
if(oth.x == x) return y < oth.y;
return x < oth.x;
}
};
vector<int> vis(N, 0);
void solve() {
cin>>n;
vector<Point> ps(n);
REP(i,n) {
ps[i].input(i);
}
sort(ps.begin(), ps.end());
vector<int> res(n);
for(int i = 0; i<n; i++) {
if(vis[ps[i].y]) continue;
res[ps[i].id] = 1;
vis[ps[i].y] = 1;
}
vis.assign(N, 0);
for(int i = n - 1; i>=0; i--) {
if(vis[ps[i].y]) continue;
res[ps[i].id] = 1;
vis[ps[i].y] = 1;
}
REP(i,n) cout<<res[i];
cout<<"\n";
}
signed main() {
// fastio();
solve();
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |