Submission #698752

# Submission time Handle Problem Language Result Execution time Memory
698752 2023-02-14T09:19:53 Z vjudge1 Circle selection (APIO18_circle_selection) C++17
0 / 100
3000 ms 16560 KB
#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 3e5 + 10, mod = 1e9 + 7;
int n, x[N], y[N], r[N], ans[N];
vector<pair<int, int> > v;
signed main()
{
    FAST;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int x1, y1, r1;
        cin >> x1 >> y1 >> r1;
        v.push_back({r1, -i});
        x[i] = x1;
        y[i] = y1;
        r[i] = r1;
    }
    sort(all(v));
    reverse(all(v));
    for(auto it : v) {
        if(ans[-it.second] == 0) {
            ans[-it.second] = -it.second;
            for(auto i : v) {
                int a = x[-it.second] - x[-i.second];
                int b = y[-it.second] - y[-i.second];
                int c = r[-it.second] + r[-i.second];
                if((a*a) + (b*b) <= (c * c)) {
                    if(ans[-i.second] == 0) ans[-i.second] = -it.second;
                    if(-i.second == 4)  cout << it.second << endl;
                }
            }
        }
    }
    for(int i = 1; i <= n; i++) cout << ans[i] << ' ';
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 147 ms 16560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3072 ms 14740 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -