답안 #698876

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698876 2023-02-14T14:42:44 Z Dodo 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 15476 KB
#include "bits/stdc++.h"
#define ll long long
#define pb push_back
#define endl '\n'

using namespace std;
ll dis(pair<ll,ll>p1,pair<ll,ll>p2)
{
  ll a=(p1.first-p2.first) , b=(p1.second-p2.second);
  return (a*a)+(b*b);
}
bool sorting (pair<ll,ll>a,pair<ll,ll>b)
{
  if(a.first!=b.first)
    return (a.first>b.first);
  return (a.second<b.second);
}

signed main () {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    vector<pair<ll,ll>>v,c;

    for(int i=0;i<n;i++)
    {
      ll x,y,r;
      cin>>x>>y>>r;
      c.pb({x,y});
      v.pb({r,i});
    }
    sort(v.begin(),v.end(),sorting);
    ll ans[n]={};
    for(int i=0;i<n;i++)
    {
      if(ans[v[i].second])continue;
      for(int j=i;j<n;j++)
      {
        if(ans[v[j].second])continue;

        if(dis(c[v[i].second],c[v[j].second])<=((v[i].first+v[j].first)*(v[i].first+v[j].first)) )
          ans[v[j].second]=v[i].second+1;
      }
    }
    for(int i=0;i<n;i++)
      cout<<ans[i]<<' ';
    return 0;
}
/*
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
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 372 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 3 ms 836 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 3 ms 716 KB Output is correct
22 Correct 29 ms 784 KB Output is correct
23 Correct 30 ms 776 KB Output is correct
24 Correct 34 ms 792 KB Output is correct
25 Correct 29 ms 768 KB Output is correct
26 Correct 29 ms 788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 148 ms 15476 KB Output is correct
2 Correct 146 ms 15356 KB Output is correct
3 Correct 143 ms 15128 KB Output is correct
4 Correct 137 ms 15404 KB Output is correct
5 Execution timed out 3099 ms 13808 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3099 ms 5404 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3066 ms 13856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 372 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 3 ms 836 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 3 ms 716 KB Output is correct
22 Correct 29 ms 784 KB Output is correct
23 Correct 30 ms 776 KB Output is correct
24 Correct 34 ms 792 KB Output is correct
25 Correct 29 ms 768 KB Output is correct
26 Correct 29 ms 788 KB Output is correct
27 Correct 5 ms 1232 KB Output is correct
28 Correct 5 ms 1208 KB Output is correct
29 Correct 5 ms 1204 KB Output is correct
30 Correct 116 ms 1188 KB Output is correct
31 Correct 124 ms 1184 KB Output is correct
32 Correct 118 ms 1192 KB Output is correct
33 Correct 53 ms 7004 KB Output is correct
34 Correct 50 ms 5976 KB Output is correct
35 Correct 59 ms 6052 KB Output is correct
36 Execution timed out 3033 ms 5484 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 372 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 3 ms 836 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 3 ms 716 KB Output is correct
22 Correct 29 ms 784 KB Output is correct
23 Correct 30 ms 776 KB Output is correct
24 Correct 34 ms 792 KB Output is correct
25 Correct 29 ms 768 KB Output is correct
26 Correct 29 ms 788 KB Output is correct
27 Correct 148 ms 15476 KB Output is correct
28 Correct 146 ms 15356 KB Output is correct
29 Correct 143 ms 15128 KB Output is correct
30 Correct 137 ms 15404 KB Output is correct
31 Execution timed out 3099 ms 13808 KB Time limit exceeded
32 Halted 0 ms 0 KB -