Submission #832105

#TimeUsernameProblemLanguageResultExecution timeMemory
8321058pete8Towers (NOI22_towers)C++17
11 / 100
1031 ms280644 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include<bitset> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #define int long long #define mod 9871 const int mxn=1e6; set<pii>x[mxn+10]; set<pii>y[mxn+10]; pii mxx[mxn+10],mxy[mxn+10]; int32_t main(){ fastio int n;cin>>n; vector<pii>v; string a=""; for(int i=0;i<n;i++)a+='0'; for(int i=0;i<=mxn;i++)mxx[i].f=mxy[i].f=INT_MAX,mxx[i].s=mxy[i].s=INT_MIN; for(int i=0;i<n;i++){ int a,b;cin>>a>>b; v.pb({a,b}); x[a].insert({b,i}); y[b].insert({a,i}); mxx[a].f=min(mxx[a].f,b); mxx[a].s=max(mxx[a].s,b); mxy[b].f=min(mxy[b].f,a); mxy[b].s=max(mxy[b].s,a); } bool yes=false; for(int i=1;i<=mxn;i++){ if(x[i].size()==0)continue; auto it=x[i].begin(),it2=x[i].end(); it2--; while(it!=it2){ yes=false; if(i!=mxy[it->f].f&&i!=mxy[it->f].s&&mxy[it->f].f!=INT_MAX)it++,yes=true; if(it==it2)break; if(i!=mxy[it2->f].f&&i!=mxy[it2->f].s&&mxy[it2->f].f!=INT_MAX)it2--,yes=true; if(!yes)break; } if(i==mxy[it->f].f||i==mxy[it->f].s||mxy[it->f].f==INT_MAX)a[it->s]='1'; if(i==mxy[it2->f].f||i==mxy[it2->f].s||mxy[it2->f].f==INT_MAX)a[it2->s]='1'; } for(int i=1;i<=mxn;i++){ if(y[i].size()==0)continue; auto it=y[i].begin(),it2=y[i].end(); it2--; while(it!=it2){ yes=false; if(i!=mxx[it->f].f&&i!=mxx[it->f].s&&mxx[it->f].f!=INT_MAX)it++,yes=true; if(it==it2)break; if(i!=mxx[it2->f].f&&i!=mxx[it2->f].s&&mxx[it2->f].f!=INT_MAX)it2--,yes=true; if(!yes)break; } if(i==mxx[it->f].f||i==mxx[it->f].s||mxx[it->f].f==INT_MAX)a[it->s]='1'; if(i==mxx[it2->f].f||i==mxx[it2->f].s||mxx[it2->f].f==INT_MAX)a[it2->s]='1'; } cout<<a; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...