이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
map<int,set<pair<int,int> >,greater<int> >circles;
map<pair<pair<int,int>,int>,int> memo;
vector<pair<pair<int,int>,int> > tab;
vector<int> res;
int n;
int x,y,z;
scanf("%d",&n);
res.resize(n);
for(int i=0; i<n; i++)
{
scanf("%d%d%d",&x,&y,&z);
circles[z].insert(make_pair(x,y));
memo[make_pair(make_pair(x,y),z)]=i;
tab.push_back(make_pair(make_pair(x,y),z));
res[i]=i+1;
}
map<int,set<pair<int,int> >,greater<int> >::iterator it;
int done=0;
while(done!=n)
{
bool test=0;
int a,b,c;
for(it=circles.begin(); it!=circles.end(); ++it)
{
int r=it->first;
if((it->second).size()!=0 && test==0)
{
test=1;
done++;
c=it->first;
a=((it->second).begin())->first;
b=((it->second).begin())->second;
(it->second).erase((it->second).begin());
}
set<pair<int,int> >::iterator posi;
for(posi=(it->second).begin(); posi!=(it->second).end(); ++posi)
{
int q=posi->first;
int p=posi->second;
if((c+r)*(c+r)>=(q-a)*(q-a)+(p-b)*(p-b))
{
done++;
res[memo[make_pair(make_pair(q,p),r)]]=memo[make_pair(make_pair(a,b),c)]+1;
(it->second).erase(posi);
}
}
}
}
for(int i=0; i<n; i++)
{
printf("%d ",res[i]);
}
}
컴파일 시 표준 에러 (stderr) 메시지
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
~~~~~^~~~~~~~~
circle_selection.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&x,&y,&z);
~~~~~^~~~~~~~~~~~~~~~~~~
circle_selection.cpp:46:22: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
if((c+r)*(c+r)>=(q-a)*(q-a)+(p-b)*(p-b))
~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |