답안 #744366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
744366 2023-05-18T13:48:54 Z haidara44 원 고르기 (APIO18_circle_selection) C++17
0 / 100
3000 ms 28460 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+1;
            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;
                    intt h=(x-x1)*(x-x1)+(y-y1)*(y-y1);
                    if(h<=r*r)
                    {
                        m[j]=i+1;
                    }
                }
            }
        }
    }
    for(auto u:m)
        cout<<u.second<<" ";
    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 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 303 ms 28460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3015 ms 27872 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 340 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 340 KB Output isn't correct
4 Halted 0 ms 0 KB -