답안 #968175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
968175 2024-04-23T08:19:09 Z socpite 원 고르기 (APIO18_circle_selection) C++14
23 / 100
1293 ms 48976 KB
#include<bits/stdc++.h>
using namespace std;

const int maxn = 3e5+5;
const int INF = 1e9;

pair<int, int> pt[maxn];
int R[maxn], removed[maxn];

int n;

bool check(int a, int b){
    return 1LL*(pt[a].first - pt[b].first)*(pt[a].first - pt[b].first) + 1LL*(pt[a].second - pt[b].second)*(pt[a].second - pt[b].second) - 1LL*(R[a] + R[b])*(R[a] + R[b])  <= 0;
}

map<pair<int, int>, vector<int>> mp;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    vector<int> vec(n);
    iota(vec.begin(), vec.end(), 1);
    int mx = 0;
    for(int i = 1; i <= n; i++){
        cin >> pt[i].first >> pt[i].second >> R[i];
        pt[i].first += INF;
        pt[i].second += INF;
        mx = max(mx, R[i]);
    }
    for(int i = 1; i <= n; i++){
        mp[{pt[i].first/mx, pt[i].second/mx}].push_back(i);
    }
    for(int i = 1; i <= n; i++){
        if(!removed[i])
        for(int j = pt[i].first/mx - 2; j <= pt[i].first/mx + 2; j++){
            for(int k = pt[i].second/mx - 2; k <= pt[i].second/mx + 2; k++){
                if(mp.find(make_pair(j, k)) == mp.end())continue;
                for(auto v: mp[{j, k}])if(!removed[v] && check(v, i))removed[v] = i;
            }
        }
        cout << removed[i] << " ";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 80 ms 15040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1293 ms 48816 KB Output is correct
2 Correct 943 ms 48296 KB Output is correct
3 Correct 285 ms 26448 KB Output is correct
4 Correct 949 ms 48712 KB Output is correct
5 Correct 905 ms 48976 KB Output is correct
6 Correct 158 ms 20048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4560 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Incorrect 1 ms 4444 KB Output isn't correct
7 Halted 0 ms 0 KB -