제출 #1318515

#제출 시각아이디문제언어결과실행 시간메모리
1318515athenaTowers (NOI22_towers)C++20
5 / 100
2103 ms161832 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int int32_t main(){ int n; cin>>n; vector<vector<int>>xx(1e6+1); vector<vector<int>>yy(1e6+1); map<pair<int,int>,int>mp; int mx=0; int my=0; int a[n],b[n]; for(int i=0;i<n;i++) { int x,y; cin>>x>>y; a[i]=x;b[i]=y; xx[x].push_back(y); yy[y].push_back(x); mp[{x,y}]=1; mx=max(mx,x); my=max(my,y); } //check for x for(int i:a) { auto c=xx[i]; sort(c.begin(),c.end()); int j=0; //for(int k:c)cout<<k<<" "; // cout<<endl; for(int u:c) { if(j==0) { j++; continue; } else if(j==c.size()-1){ // cout<<"J "<<j<<" U "<<u<<endl; break; } else{ mp[{i,u}]=0; //cout<<"HEHE"<<endl; } j++; } // mp[{i,c[0]}]=1; // mp[{i,c[c.size()-1]}]=1; } for(int i:b) { auto c=yy[i]; sort(c.begin(),c.end()); int j=0; for(int u:c) { if(j==0) { j++; continue; } else if(j==c.size()-1) break; else mp[{u,i}]=0; j++; } // mp[{i,c[0]}]=1; // mp[{i,c[c.size()-1]}]=1; } int ans[n]; for (const auto& p : mp) { int g=p.first.first; int h=p.first.second; for(int i=0;i<n;i++) {if(a[i]==g&&b[i]==h){ // cout<<a[i]<<" "<<b[i]<<" "<<p.first.first<<" "<<p.first.second<<endl; ans[i]=p.second; break; } } // cout<<p.first.first<<" "<<p.first.second<<" "<<p.second<<endl;; } //cout<<endl; for(int i=0;i<n;i++)cout<<ans[i]; 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...