답안 #124097

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124097 2019-07-02T14:12:47 Z HassenAissa 원 고르기 (APIO18_circle_selection) C++14
0 / 100
3000 ms 83628 KB
#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;

int32_t main()
{
    map<int,set<pair<int,int> >,greater<int> >circles;
    map<pair<pair<int,int>,int>,int> memo;
    vector<pair<pair<int,int>,int> > tab;
    vector<int> res;

    int n;
    int x,y,z;
    scanf("%lld",&n);
    res.resize(n);
    for(int i=0; i<n; i++)
    {
        scanf("%d%d%d",&x,&y,&z);
        circles[z].insert(make_pair(x,y));
        memo[make_pair(make_pair(x,y),z)]=i;
        tab.push_back(make_pair(make_pair(x,y),z));
        res[i]=i+1;
    }
    map<int,set<pair<int,int> >,greater<int> >::iterator it;
    int done=0;
    while(done<=n)
    {
        bool test=0;
        int a,b,c;
        it=circles.begin();
        while((it->second).size()==0)
        {
            it++;
        }

        c=it->first;
        a=((it->second).begin())->first;
        b=((it->second).begin())->second;
        (it->second).erase((it->second).begin());
        done++;
        for(it=circles.begin(); it!=circles.end(); ++it)
        {
            int r=it->first;
            set<pair<int,int> >::iterator posi;
            for(posi=(it->second).begin(); posi!=(it->second).end(); ++posi)
            {
                int q=posi->first;
                int p=posi->second;

                if((c+r)*(c+r)>=(q-a)*(q-a)+(p-b)*(p-b))
                {
                    done++;
                    res[memo[make_pair(make_pair(q,p),r)]]=memo[make_pair(make_pair(a,b),c)]+1;
                    (it->second).erase(posi);
                }
            }
        }
    }
    for(int i=0; i<n; i++)
    {
        printf("%lld ",res[i]);
    }

    return 0;
}

Compilation message

circle_selection.cpp: In function 'int32_t main()':
circle_selection.cpp:18:32: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long unsigned int*' [-Wformat=]
         scanf("%d%d%d",&x,&y,&z);
                        ~~      ^
circle_selection.cpp:18:32: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long unsigned int*' [-Wformat=]
circle_selection.cpp:18:32: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'long long unsigned int*' [-Wformat=]
circle_selection.cpp:28:14: warning: unused variable 'test' [-Wunused-variable]
         bool test=0;
              ^~~~
circle_selection.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
circle_selection.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&x,&y,&z);
         ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1488 ms 83628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3032 ms 52996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -