Submission #106542

# Submission time Handle Problem Language Result Execution time Memory
106542 2019-04-19T03:21:34 Z username Circle selection (APIO18_circle_selection) C++14
Compilation error
0 ms 0 KB
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define int int_fast64_t
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> VI;
#define REP(i,j,k) for(register int i=(j);i<(k);++i)
#define RREP(i,j,k) for(register int i=(j)-1;i>=(k);--i)
#define ALL(a) a.begin(),a.end()
#define MST(a,v) memset(a,(v),sizeof a)
#define pb push_back
#define F first
#define S second
#define endl '\n'
//																#define __debug
#ifdef __debug
	#define IOS (void)0
	#define de(...) cerr<<__VA_ARGS__
	#define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);}
#else
	#define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false)
	#define de(...) (void)0
	#define ar(...) (void)0
#endif
/***********************************default***********************************/
#define f2(x) ((x)*(x))
const int maxn=3e5+9,inf=1ll<<60,bl=3e9;
struct C{int x,y,r,id;}a[maxn];
int n,rmv[maxn],res[maxn];
unordered_map<int,list<int>>mp;
list<int>ls;
 
main(){
	IOS;
	cin>>n;
	REP(i,0,n)cin>>a[i].x>>a[i].y>>a[i].r,a[i].id=i;
	sort(a,a+n,[](C x,C y){return x.r==y.r?x.id<y.id:x.r>y.r;});
//	MST(rmv,0);
	int k=inf;
	REP(i,0,n){
		if(rmv[i])continue;
		if(2*a[i].r<k){
			k=a[i].r;
			mp.clear();
			REP(j,0,n){
				if(!rmv[j]){
					mp[a[j].x/k*bl+a[j].y/k].pb(j);
				}
			}
		}
		REP(x,a[i].x/k-2,a[i].x/k+3)REP(y,a[i].y/k-2,a[i].y/k+3){
			auto&tls=mp[x*bl+y];
			for(auto it=tls.begin();it!=tls.end();++it){
				if(rmv[*it])continue;
				C c=a[*it];
				if(f2(a[i].x-c.x)+f2(a[i].y-c.y)<=f2(a[i].r+c.r)){
					res[c.id]=a[i].id;
					rmv[*it]=1;
//					tls.erase(it++);
				}a#include<bits/stdc++.h>
#define int int64_t
using namespace std;
typedef pair<int,int> pii;
#define REP(i,j,k) for(int i=(j);i<(k);++i)
#define pb push_back
#define F first
#define S second
#define IOS cin.tie(0),ios_base::sync_with_stdio(false)
#define f2(x) ((x)*(x))

const int maxn=3e5+3,inf=1ll<<60,bl=2e9+3;
struct C{int x,y,r,id;}a[maxn];
int n,res[maxn];
bitset<maxn>rmv;
unordered_map<int,vector<int>>mp;
 
main(){
	IOS;
	cin>>n;
	REP(i,0,n)cin>>a[i].x>>a[i].y>>a[i].r,a[i].id=i;
	sort(a,a+n,[](C x,C y){return x.r==y.r?x.id<y.id:x.r>y.r;});
	int k=inf;
	REP(i,0,n){
		if(rmv[i])continue;
		if(2*a[i].r<k){
			k=a[i].r;
			mp.clear();
			REP(j,i,n)if(!rmv[j])mp[a[j].x/k*bl+a[j].y/k].pb(j);
		}
		int xx=a[i].x/k,yy=a[i].y/k;
		REP(x,xx-2,xx+3)REP(y,yy-2,yy+3){
			auto&tls=mp[x*bl+y];
			for(auto it=tls.begin();it!=tls.end();++it){
				if(!rmv[*it]&&f2(a[i].x-a[*it].x)+f2(a[i].y-a[*it].y)<=f2(a[i].r+a[*it].r)){
					res[a[*it].id]=a[i].id;
					rmv[*it]=1;
				}
			}
		}
	}
	REP(i,0,n)cout<<res[i]+1<<" ";
}
			}
		}
	}
	REP(i,0,n)cout<<res[i]+1<<" ";
}

Compilation message

circle_selection.cpp:60:7: error: stray '#' in program
     }a#include<bits/stdc++.h>
       ^
circle_selection.cpp:61:0: warning: "int" redefined
 #define int int64_t
 
circle_selection.cpp:3:0: note: this is the location of the previous definition
 #define int int_fast64_t
 
circle_selection.cpp:64:0: warning: "REP" redefined
 #define REP(i,j,k) for(int i=(j);i<(k);++i)
 
circle_selection.cpp:7:0: note: this is the location of the previous definition
 #define REP(i,j,k) for(register int i=(j);i<(k);++i)
 
circle_selection.cpp:68:0: warning: "IOS" redefined
 #define IOS cin.tie(0),ios_base::sync_with_stdio(false)
 
circle_selection.cpp:21:0: note: this is the location of the previous definition
  #define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false)
 
circle_selection.cpp:33:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:60:8: error: expected ';' before 'include'
     }a#include<bits/stdc++.h>
        ^~~~~~~
circle_selection.cpp:62:20: warning: statement has no effect [-Wunused-value]
 using namespace std;
                    ^
circle_selection.cpp:77:7: error: expected ';' before '{' token
 main(){
       ^
circle_selection.cpp:71:22: warning: unused variable 'inf' [-Wunused-variable]
 const int maxn=3e5+3,inf=1ll<<60,bl=2e9+3;
                      ^~~
circle_selection.cpp:71:34: warning: unused variable 'bl' [-Wunused-variable]
 const int maxn=3e5+3,inf=1ll<<60,bl=2e9+3;
                                  ^~
circle_selection.cpp:72:24: warning: unused variable 'a' [-Wunused-variable]
 struct C{int x,y,r,id;}a[maxn];
                        ^
circle_selection.cpp:73:5: warning: unused variable 'n' [-Wunused-variable]
 int n,res[maxn];
     ^
circle_selection.cpp:73:7: warning: unused variable 'res' [-Wunused-variable]
 int n,res[maxn];
       ^~~