답안 #832105

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832105 2023-08-21T00:37:09 Z 8pete8 Towers (NOI22_towers) C++17
11 / 100
1031 ms 280644 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 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 125488 KB Output is correct
2 Correct 52 ms 125496 KB Output is correct
3 Correct 52 ms 125460 KB Output is correct
4 Correct 54 ms 125444 KB Output is correct
5 Correct 54 ms 125484 KB Output is correct
6 Correct 53 ms 125424 KB Output is correct
7 Correct 53 ms 125524 KB Output is correct
8 Correct 54 ms 125548 KB Output is correct
9 Correct 54 ms 125480 KB Output is correct
10 Correct 53 ms 125500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 125488 KB Output is correct
2 Correct 52 ms 125496 KB Output is correct
3 Correct 52 ms 125460 KB Output is correct
4 Correct 54 ms 125444 KB Output is correct
5 Correct 54 ms 125484 KB Output is correct
6 Correct 53 ms 125424 KB Output is correct
7 Correct 53 ms 125524 KB Output is correct
8 Correct 54 ms 125548 KB Output is correct
9 Correct 54 ms 125480 KB Output is correct
10 Correct 53 ms 125500 KB Output is correct
11 Correct 53 ms 125428 KB Output is correct
12 Correct 54 ms 125432 KB Output is correct
13 Correct 59 ms 125564 KB Output is correct
14 Correct 60 ms 125476 KB Output is correct
15 Correct 53 ms 125524 KB Output is correct
16 Correct 53 ms 125552 KB Output is correct
17 Incorrect 53 ms 125492 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 101 ms 139424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1027 ms 280568 KB Output is correct
2 Correct 1014 ms 280644 KB Output is correct
3 Correct 1030 ms 280576 KB Output is correct
4 Correct 1031 ms 280496 KB Output is correct
5 Correct 1004 ms 280568 KB Output is correct
6 Correct 856 ms 280396 KB Output is correct
7 Correct 821 ms 280540 KB Output is correct
8 Correct 886 ms 280400 KB Output is correct
9 Correct 825 ms 280460 KB Output is correct
10 Correct 851 ms 280444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 125488 KB Output is correct
2 Correct 52 ms 125496 KB Output is correct
3 Correct 52 ms 125460 KB Output is correct
4 Correct 54 ms 125444 KB Output is correct
5 Correct 54 ms 125484 KB Output is correct
6 Correct 53 ms 125424 KB Output is correct
7 Correct 53 ms 125524 KB Output is correct
8 Correct 54 ms 125548 KB Output is correct
9 Correct 54 ms 125480 KB Output is correct
10 Correct 53 ms 125500 KB Output is correct
11 Correct 53 ms 125428 KB Output is correct
12 Correct 54 ms 125432 KB Output is correct
13 Correct 59 ms 125564 KB Output is correct
14 Correct 60 ms 125476 KB Output is correct
15 Correct 53 ms 125524 KB Output is correct
16 Correct 53 ms 125552 KB Output is correct
17 Incorrect 53 ms 125492 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 125488 KB Output is correct
2 Correct 52 ms 125496 KB Output is correct
3 Correct 52 ms 125460 KB Output is correct
4 Correct 54 ms 125444 KB Output is correct
5 Correct 54 ms 125484 KB Output is correct
6 Correct 53 ms 125424 KB Output is correct
7 Correct 53 ms 125524 KB Output is correct
8 Correct 54 ms 125548 KB Output is correct
9 Correct 54 ms 125480 KB Output is correct
10 Correct 53 ms 125500 KB Output is correct
11 Correct 53 ms 125428 KB Output is correct
12 Correct 54 ms 125432 KB Output is correct
13 Correct 59 ms 125564 KB Output is correct
14 Correct 60 ms 125476 KB Output is correct
15 Correct 53 ms 125524 KB Output is correct
16 Correct 53 ms 125552 KB Output is correct
17 Incorrect 53 ms 125492 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 125488 KB Output is correct
2 Correct 52 ms 125496 KB Output is correct
3 Correct 52 ms 125460 KB Output is correct
4 Correct 54 ms 125444 KB Output is correct
5 Correct 54 ms 125484 KB Output is correct
6 Correct 53 ms 125424 KB Output is correct
7 Correct 53 ms 125524 KB Output is correct
8 Correct 54 ms 125548 KB Output is correct
9 Correct 54 ms 125480 KB Output is correct
10 Correct 53 ms 125500 KB Output is correct
11 Correct 53 ms 125428 KB Output is correct
12 Correct 54 ms 125432 KB Output is correct
13 Correct 59 ms 125564 KB Output is correct
14 Correct 60 ms 125476 KB Output is correct
15 Correct 53 ms 125524 KB Output is correct
16 Correct 53 ms 125552 KB Output is correct
17 Incorrect 53 ms 125492 KB Output isn't correct
18 Halted 0 ms 0 KB -