답안 #164594

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164594 2019-11-21T22:11:07 Z Rouge_Hugo 원 고르기 (APIO18_circle_selection) C++14
12 / 100
2160 ms 111512 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=8*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 41 ms 37880 KB Output is correct
2 Correct 41 ms 37880 KB Output is correct
3 Incorrect 40 ms 37884 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2160 ms 104632 KB Output is correct
2 Correct 2107 ms 111388 KB Output is correct
3 Correct 2115 ms 111140 KB Output is correct
4 Correct 2121 ms 111512 KB Output is correct
5 Correct 1632 ms 88276 KB Output is correct
6 Correct 2104 ms 108548 KB Output is correct
7 Correct 1893 ms 105160 KB Output is correct
8 Correct 1866 ms 106764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 37880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1870 ms 104404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 37880 KB Output is correct
2 Correct 41 ms 37880 KB Output is correct
3 Incorrect 40 ms 37884 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 37880 KB Output is correct
2 Correct 41 ms 37880 KB Output is correct
3 Incorrect 40 ms 37884 KB Output isn't correct
4 Halted 0 ms 0 KB -