답안 #698773

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698773 2023-02-14T09:39:28 Z vjudge1 원 고르기 (APIO18_circle_selection) C++17
0 / 100
143 ms 11392 KB
#include <bits/stdc++.h>
///#include <fstream>
#define endl '\n'
#define mod 998244353
#define INF 100000000000000
#define ll long long
///#define cin fin
///#define cout fout
#define fi first
#define se second
using namespace std;
///ofstream fout("herding.out");
///ifstream fin("herding.in");
bool cmp(pair<pair<long long, int>,pair<long long, long long>> a, pair<pair<long long, int>,pair<long long, long long>> b) {
    if(a.fi.fi != b.fi.fi) return a.fi.fi > b.fi.fi;
    else return a.fi.se < b.fi.se;
}
int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n; cin >> n; pair<pair<long long, int>,pair<long long, long long>> arr[n]; int ans[n];
    for(int i = 0; i < n; i++) ans[i] = i+1;
    for(int i = 0; i < n; i++) {
        long long x, y, r; cin >> x >> y >> r;
        arr[i].fi.fi = r; arr[i].fi.se = i;
        arr[i].se.fi = x; arr[i].se.se = y;
    }
    sort(arr,arr+n,cmp);
    for(int i = 0; i < n; i++) {
        if(ans[i] != i+1) continue;
        for(int j = i+1; j < n; j++) {
            long long x1 = arr[i].se.fi, y1 = arr[i].se.se, r1 = arr[i].fi.fi;
            long long x2 = arr[j].se.fi, y2 = arr[j].se.se, r2 = arr[j].fi.fi;
            if((y1+r1 == y2-r2 || y1-r1 == y2+r2) && x1 == x2) {
                ans[j] = i+1;
            }
            else if(y1 == y2 && (x1+r1 == x2-r2 || x1-r1 == x2+r2)) {
                ans[j] = i+1;
            }
            else if(y1-r1 < y2+r2 && x1+r1 > x2-r2) {
                ans[j] = i+1;
            }
            else if(y1+r1 > y2-r2 && x1-r1 < x2+r2) {
                ans[j] = i+1;
            }
            else if(y1-r1 < y2+r2 && x1-r1 < x2+r2) {
                ans[j] = i+1;
            }
            else if(y1+r1 > y2-r2 && x1+r1 > x2-r2) {
                ans[j] = i+1;
            }
        }
    }
    for(int i = 0; i < n; i++) cout << ans[i] << ' ';
   /* int n; cin >> n; long long arr[n]; vector<pair<pair<int,long long>,int>> v; long long ans[n];
    for(int i = 0; i < n; i++) ans[i] = i+1;
    for(int i = 0; i < n; i++) {
        long long x, y, r; cin >> x >> y >> r; arr[i] = r;
        v.push_back({{1,x-r},i});
        v.push_back({{2,x+r},i});
    }
    sort(v.begin(),v.end()); priority_queue<pair<long long, long long>> pq;
    for(int i = 0; i < v.size(); i++) {
        int ind = v[i].second;
        pq.push({arr[ind],-ind});
        if(!pq.empty() &&)
    }*/
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 143 ms 11372 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 Incorrect 139 ms 11392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -