답안 #710053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710053 2023-03-15T04:07:14 Z vjudge1 원 고르기 (APIO18_circle_selection) C++17
0 / 100
977 ms 52300 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 3e5 + 10;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define ff first
#define ss second
int calc(ii x, ii y)
{
    return (x.ff-y.ff)*(x.ff-y.ff) + (x.ss-y.ss)*(x.ss-y.ss);
}
bool dau[maxn];
int res[maxn];
int n;
iii a[maxn];
int id[maxn];
int f[maxn];
void update(int x, int val)
{
    while (x<=n)
    {
        f[x] += val;
    }
}
multiset<ii> ms;
bool cmp(int x, int y)
{
    if (a[x].ss!=a[y].ss) return a[x].ss>a[y].ss;
    return x<y;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>a[i].ff.ff>>a[i].ff.ss>>a[i].ss;
        ms.insert({a[i].ff.ff-a[i].ss,i});
        ms.insert({a[i].ff.ff+a[i].ss,i});
        dau[i]=0;
        id[i]=i;
    }
    sort(id+1,id+n+1,cmp);
    for (int i=1; i<=n; i++)
    {
        int j = id[i];
        ii temp = {a[j].ff.ff - a[j].ss, -1};
        auto x = ms.lower_bound(temp);
        vector <int> tmp;
        while (x!=ms.end()&&(*x).ff <= a[j].ff.ff + a[j].ss)
        {
            int v = (*x).ss; x++;
//            cerr<<j<<" :: "<<v<<endl;
            if (!dau[v])
            {
                dau[v] = 1;
                tmp.push_back(v);
            }
        }
//        cerr<<":)"<<endl;
        for (int u:tmp)
        {
            res[u] = j;
//            cerr<<u<<" :: "<<a[u].ff.ff-a[u].ss<<" "<<a[u].ff.ff+a[u].ss<<endl;
            ms.erase(ms.find({a[u].ff.ff-a[u].ss,u}));
            ms.erase(ms.find({a[u].ff.ff+a[u].ss,u}));
        }
    }
    for (int i=1; i<=n; i++) cout<<res[i]<<' '; cout<<'\n';
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:71:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   71 |     for (int i=1; i<=n; i++) cout<<res[i]<<' '; cout<<'\n';
      |     ^~~
circle_selection.cpp:71:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   71 |     for (int i=1; i<=n; i++) cout<<res[i]<<' '; cout<<'\n';
      |                                                 ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 0 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 977 ms 52300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 670 ms 51664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 0 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 0 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -