답안 #164592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164592 2019-11-21T22:03:42 Z Rouge_Hugo 원 고르기 (APIO18_circle_selection) C++14
0 / 100
797 ms 98876 KB
#include <bits/stdc++.h>
#define ll long long
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int n,x,y,z;
const int N=3*100005;
int  vis[N];
map<int,int>m;
pair<int,int>a[N];
set<pair<int,int>>s;vector<int>v[N];vector<int>v1[N];
void cl(int ii ,int r)
{   for(int i=m[a[ii].first-a[ii].second];i<=m[a[ii].first+a[ii].second];i++)
    {
        for(auto it:v[i])
        {
            if (vis[it])continue;
            s.erase({a[it].second,-it});
            vis[it]=r;

        }
        for(auto it:v1[i])
        {
            if (vis[it])continue;
            s.erase({a[it].second,-it});
            vis[it]=r;
        }
    }
}
int main()
{
    fast
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>z;cin>>z;
        a[i]={x,z};
        m[x+z]++;m[x-z]++;
    }
    int re=0;
    for(auto it:m)
    {
        m[it.first]=++re;
    }
    for(int i=0;i<n;i++)
    {
        x=m[a[i].first-a[i].second];
        y=m[a[i].first+a[i].second];
        v[x].push_back(i);v1[y].push_back(i);
    }
    for(int i=0;i<n;i++)
        s.insert({a[i].second,-i});
    while (!s.empty())
    {
        pair<int,int>w=*s.rbegin();
        w.second=-w.second;

        cl(w.second,w.second+1);
    }
  for(int i=0;i<n;i++)cout<<vis[i]<<" ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 14584 KB Output is correct
2 Correct 15 ms 14456 KB Output is correct
3 Incorrect 14 ms 14456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 797 ms 97696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 14456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 729 ms 98876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 14584 KB Output is correct
2 Correct 15 ms 14456 KB Output is correct
3 Incorrect 14 ms 14456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 14584 KB Output is correct
2 Correct 15 ms 14456 KB Output is correct
3 Incorrect 14 ms 14456 KB Output isn't correct
4 Halted 0 ms 0 KB -