답안 #50098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
50098 2018-06-07T14:08:02 Z zetapi 원 고르기 (APIO18_circle_selection) C++14
23 / 100
2167 ms 143512 KB
#include <bits/stdc++.h>
using namespace std;
 
#define pb  push_back
#define mp  make_pair
#define int long long
#define itr ::iterator 
 
typedef pair<int,int>  pii;
 
const int MAX=4e5;
const int INF=1e12;
 
set<int> st;

map<int,int> maps;

vector< vector<pii> > vec(MAX);
 
int N,mnx,mny,ptr,X[MAX],Y[MAX],R[MAX],par[MAX],block[MAX][2];
 
bool ok(int F,int S)
{
	if((X[F]-X[S])*(X[F]-X[S])+(Y[F]-Y[S])*(Y[F]-Y[S])>(R[F]+R[S])*(R[F]+R[S]))
		return false;
	return true;
}
 
signed main()
{
	ios_base::sync_with_stdio(false);
	/*cin.tie(0);
	cout.tie(0);*/
 	
 	/* 	input
 		11
		9 9 2
		13 2 1
		11 8 2
		3 3 2
		3 12 1
		12 14 1
		9 8 5
		2 8 2
		5 2 1
		14 4 2
		14 14 1
	*/
 	mnx=INF;
 	mny=INF;
 	int k=-INF;
	cin>>N;
	for(int A=1;A<=N;A++)
	{
		cin>>X[A]>>Y[A]>>R[A];
		mnx=min(mnx,X[A]);
		mnx=min(mnx,Y[A]);
		k=max(k,R[A]);
	}
	for(int A=1;A<=N;A++)
	{
		X[A]-=mnx;
		Y[A]-=mnx;
		block[A][0]=X[A]/k;
		block[A][1]=Y[A]/k;
		st.insert(block[A][1]);
	}
	for(auto A:st)
		maps[A]=++ptr;
	for(int A=1;A<=N;A++)
		vec[maps[block[A][1]]].pb(mp(block[A][0],A));
	for(int A=1;A<=N;A++)
	{
		if(par[A])
			continue;
		par[A]=A;
		for(int B,C=block[A][1]-2;C<=block[A][1]+2;C++)
		{
			B=maps[C];
			if(vec[B].empty())
				continue;
			pii lol=mp(block[A][0]-2,0);
			for(vector<pii> itr it=vec[B].begin();it!=vec[B].end();it++)
			{
				if(par[it->second])
					continue;
				if(ok(A,it->second))
					par[it->second]=A;
			}
		}
	}
	for(int A=1;A<=N;A++)
		cout<<par[A]<<" ";
	return 0;
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:82:8: warning: variable 'lol' set but not used [-Wunused-but-set-variable]
    pii lol=mp(block[A][0]-2,0);
        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9832 KB Output is correct
3 Correct 10 ms 9892 KB Output is correct
4 Correct 11 ms 9892 KB Output is correct
5 Correct 10 ms 9892 KB Output is correct
6 Incorrect 10 ms 9968 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 212 ms 30100 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 30100 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1569 ms 47192 KB Output is correct
2 Correct 2104 ms 143512 KB Output is correct
3 Correct 1680 ms 143512 KB Output is correct
4 Correct 2167 ms 143512 KB Output is correct
5 Correct 2040 ms 143512 KB Output is correct
6 Correct 575 ms 143512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9832 KB Output is correct
3 Correct 10 ms 9892 KB Output is correct
4 Correct 11 ms 9892 KB Output is correct
5 Correct 10 ms 9892 KB Output is correct
6 Incorrect 10 ms 9968 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9832 KB Output is correct
3 Correct 10 ms 9892 KB Output is correct
4 Correct 11 ms 9892 KB Output is correct
5 Correct 10 ms 9892 KB Output is correct
6 Incorrect 10 ms 9968 KB Output isn't correct
7 Halted 0 ms 0 KB -