제출 #97017

#제출 시각아이디문제언어결과실행 시간메모리
97017KastandaThe Forest of Fangorn (CEOI14_fangorn)C++11
50 / 100
3012 ms1152 KiB
// And you were like ooo-aa--ooo
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair < ll , ll > pii;
const int N = 205, MXN = 10004;
int n, m, W, H, A[N], B[N], X[MXN], Y[MXN];
vector < ld > Ang[N];
void Prnt(vector < int > vec)
{
    for (int id : vec)
        printf("%d ", id);
    printf("\n");
}
int main()
{
    scanf("%d%d%d%d%d", &W, &H, &X[0], &Y[0], &m);
    for (int i = 1; i <= m; i ++)
        scanf("%d%d", &X[i], &Y[i]);
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++)
        scanf("%d%d", &A[i], &B[i]);
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)
            if (i != j)
                Ang[i].push_back(arg(complex < ld > {(ld)(A[i] - A[j]), (ld)(B[i] - B[j])}));
        sort(Ang[i].begin(), Ang[i].end());
    }
    vector < int > vec;
    vector < int > LB0;
    for (int j = 1; j <= n; j ++)
    {
        ld ang = arg(complex < ld > {(ld)(X[0] - A[j]), (ld)(Y[0] - B[j])});
        LB0.push_back(lower_bound(Ang[j].begin(), Ang[j].end(), ang) - Ang[j].begin());
        if (LB0.back() == Ang[j].size())
            LB0.back() = 0;
    }
    for (int i = 1; i <= m; i ++)
    {
        vector < int > LB;
        for (int j = 1; j <= n; j ++)
        {
            ld ang = arg(complex < ld > {(ld)(X[i] - A[j]), (ld)(Y[i] - B[j])});
            LB.push_back(lower_bound(Ang[j].begin(), Ang[j].end(), ang) - Ang[j].begin());
            if (LB.back() == Ang[j].size())
                LB.back() = 0;
        }
        if (LB == LB0)
            vec.push_back(i);
    }
    printf("%d\n", (int)vec.size());
    for (int id : vec)
        printf("%d ", id);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

fangorn.cpp: In function 'int main()':
fangorn.cpp:37:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (LB0.back() == Ang[j].size())
             ~~~~~~~~~~~^~~~~~~~~~~~~~~~
fangorn.cpp:47:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (LB.back() == Ang[j].size())
                 ~~~~~~~~~~^~~~~~~~~~~~~~~~
fangorn.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d%d%d", &W, &H, &X[0], &Y[0], &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fangorn.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &X[i], &Y[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
fangorn.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
fangorn.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &A[i], &B[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...