Submission #832108

# Submission time Handle Problem Language Result Execution time Memory
832108 2023-08-21T00:47:03 Z 8pete8 Towers (NOI22_towers) C++17
11 / 100
1038 ms 284108 KB
#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 ppii pair<pii,pii>
#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,inf=1e7;
set<pii>x[mxn+10];
set<pii>y[mxn+10];
ppii mxx[mxn+10],mxy[mxn+10];
int32_t main(){
    fastio
    int n;cin>>n;
    string a="";
    for(int i=0;i<n;i++)a+='0';
    for(int i=0;i<=mxn;i++)mxx[i].f.f=mxy[i].f.f=inf,mxx[i].s.f=mxy[i].s.f=-1;
    for(int i=0;i<n;i++){
        int a,b;cin>>a>>b;
        x[a].insert({b,i});
        y[b].insert({a,i});
        mxx[a].f=min(mxx[a].f,{b,i});
        mxx[a].s=max(mxx[a].s,{b,i});
        mxy[b].f=min(mxy[b].f,{a,i});
        mxy[b].s=max(mxy[b].s,{a,i});
    }
    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.f&&i!=mxy[it->f].s.f&&mxy[it->f].f.f!=inf){
                it++,yes=true;
                a[mxy[it->f].f.s]='1';
                a[mxy[it->f].s.s]='1';
            }
            if(it==it2)break;
            if(i!=mxy[it2->f].f.f&&i!=mxy[it2->f].s.f&&mxy[it2->f].f.f!=inf){
                it2--,yes=true;
                a[mxy[it2->f].f.s]='1';
                a[mxy[it2->f].s.s]='1';
            }
            if(!yes)break;
        }
        if(i==mxy[it->f].f.f||i==mxy[it->f].s.f||mxy[it->f].f.f==inf)a[it->s]='1';
        if(i==mxy[it2->f].f.f||i==mxy[it2->f].s.f||mxy[it2->f].f.f==inf)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!=inf)it++,yes=true;
            if(it==it2)break;
            if(i!=mxx[it2->f].f&&i!=mxx[it2->f].s&&mxx[it2->f].f!=inf)it2--,yes=true;
            if(!yes)break;
        }
        if(i==mxx[it->f].f||i==mxx[it->f].s||mxx[it->f].f==inf)a[it->s]='1';
        if(i==mxx[it2->f].f||i==mxx[it2->f].s||mxx[it2->f].f==inf)a[it2->s]='1';
    }
    */
    cout<<a;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 58 ms 156856 KB Output is correct
2 Correct 60 ms 156844 KB Output is correct
3 Correct 63 ms 156984 KB Output is correct
4 Correct 59 ms 156816 KB Output is correct
5 Correct 68 ms 156856 KB Output is correct
6 Correct 60 ms 156812 KB Output is correct
7 Correct 59 ms 156752 KB Output is correct
8 Correct 59 ms 156832 KB Output is correct
9 Correct 57 ms 156736 KB Output is correct
10 Correct 58 ms 156856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 156856 KB Output is correct
2 Correct 60 ms 156844 KB Output is correct
3 Correct 63 ms 156984 KB Output is correct
4 Correct 59 ms 156816 KB Output is correct
5 Correct 68 ms 156856 KB Output is correct
6 Correct 60 ms 156812 KB Output is correct
7 Correct 59 ms 156752 KB Output is correct
8 Correct 59 ms 156832 KB Output is correct
9 Correct 57 ms 156736 KB Output is correct
10 Correct 58 ms 156856 KB Output is correct
11 Incorrect 59 ms 156760 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 168552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1034 ms 284092 KB Output is correct
2 Correct 1008 ms 284108 KB Output is correct
3 Correct 978 ms 284072 KB Output is correct
4 Correct 1022 ms 284012 KB Output is correct
5 Correct 1038 ms 284072 KB Output is correct
6 Correct 794 ms 284088 KB Output is correct
7 Correct 756 ms 283980 KB Output is correct
8 Correct 759 ms 283996 KB Output is correct
9 Correct 763 ms 284080 KB Output is correct
10 Correct 751 ms 284052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 156856 KB Output is correct
2 Correct 60 ms 156844 KB Output is correct
3 Correct 63 ms 156984 KB Output is correct
4 Correct 59 ms 156816 KB Output is correct
5 Correct 68 ms 156856 KB Output is correct
6 Correct 60 ms 156812 KB Output is correct
7 Correct 59 ms 156752 KB Output is correct
8 Correct 59 ms 156832 KB Output is correct
9 Correct 57 ms 156736 KB Output is correct
10 Correct 58 ms 156856 KB Output is correct
11 Incorrect 59 ms 156760 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 156856 KB Output is correct
2 Correct 60 ms 156844 KB Output is correct
3 Correct 63 ms 156984 KB Output is correct
4 Correct 59 ms 156816 KB Output is correct
5 Correct 68 ms 156856 KB Output is correct
6 Correct 60 ms 156812 KB Output is correct
7 Correct 59 ms 156752 KB Output is correct
8 Correct 59 ms 156832 KB Output is correct
9 Correct 57 ms 156736 KB Output is correct
10 Correct 58 ms 156856 KB Output is correct
11 Incorrect 59 ms 156760 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 156856 KB Output is correct
2 Correct 60 ms 156844 KB Output is correct
3 Correct 63 ms 156984 KB Output is correct
4 Correct 59 ms 156816 KB Output is correct
5 Correct 68 ms 156856 KB Output is correct
6 Correct 60 ms 156812 KB Output is correct
7 Correct 59 ms 156752 KB Output is correct
8 Correct 59 ms 156832 KB Output is correct
9 Correct 57 ms 156736 KB Output is correct
10 Correct 58 ms 156856 KB Output is correct
11 Incorrect 59 ms 156760 KB Output isn't correct
12 Halted 0 ms 0 KB -