답안 #744360

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
744360 2023-05-18T13:44:30 Z haidara44 원 고르기 (APIO18_circle_selection) C++17
0 / 100
3000 ms 33932 KB
#include <bits/stdc++.h>

using namespace std;
#define endl '\n'
#define intt long long
#define mid (l+r)/2

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    intt n;
    cin>>n;
    vector<pair<intt,pair<intt,intt>>>v;
    map<intt,intt>m;
    for(int i=0;i<n;i++)
    {
        intt x,y,r;
        cin>>x>>y>>r;
        v.push_back({r,{x,y}});
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    for(int i=0;i<n;i++)
    {
        if(!m[i])
        {
            m[i]=i;
            intt x=v[i].second.first;
            intt y=v[i].second.second;
            intt r=v[i].first;
            for(int j=0;j<n;j++)
            {
                if(!m[j])
                {
                    intt x1=v[j].second.first;
                    intt y1=v[j].second.second;
                    intt r1=v[j].first;
                    double h=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
                    if(h<=r)
                    {
                        m[j]=i;
                    }
                }
            }
        }
    }
    for(auto u:m)
        cout<<u.second+1<<" ";
    return 0;
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:39:26: warning: unused variable 'r1' [-Wunused-variable]
   39 |                     intt r1=v[j].first;
      |                          ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 332 ms 33472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3013 ms 33932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -