Submission #97021

# Submission time Handle Problem Language Result Execution time Memory
97021 2019-02-13T10:52:49 Z Kastanda The Forest of Fangorn (CEOI14_fangorn) C++11
100 / 100
2904 ms 760 KB
// 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 = 2005, MXN = 10004;
int n, m, W, H, A[N], B[N], X[MXN], Y[MXN];
bool M[MXN];
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]);
    vector < ld > Ang;
    for (int i = 1; i <= n; i ++)
    {
        Ang.clear();
        for (int j = 1; j <= n; j ++)
            if (i != j)
                Ang.push_back(arg(complex < ld > {(ld)(A[i] - A[j]), (ld)(B[i] - B[j])}));
        sort(Ang.begin(), Ang.end());

        ld ang = arg(complex < ld > {(ld)(X[0] - A[i]), (ld)(Y[0] - B[i])});
        int lb0 = lower_bound(Ang.begin(), Ang.end(), ang) - Ang.begin();
        if (lb0 == Ang.size()) lb0 = 0;

        for (int j = 1; j <= m; j++)
        {
            ld ang = arg(complex < ld > {(ld)(X[j] - A[i]), (ld)(Y[j] - B[i])});
            int lb = lower_bound(Ang.begin(), Ang.end(), ang) - Ang.begin();
            if (lb == Ang.size()) lb = 0;

            if (lb != lb0)
                M[j] = 1;
        }
    }
    vector < int > vec;
    for (int i = 1; i <= m; i++)
        if (!M[i])
            vec.push_back(i);
    printf("%d\n", (int)vec.size());
    for (int id : vec)
        printf("%d ", id);
    return 0;
}

Compilation message

fangorn.cpp: In function 'int main()':
fangorn.cpp:29:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (lb0 == Ang.size()) lb0 = 0;
             ~~~~^~~~~~~~~~~~~
fangorn.cpp:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (lb == Ang.size()) lb = 0;
                 ~~~^~~~~~~~~~~~~
fangorn.cpp:12: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:14: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:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
fangorn.cpp:17: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 time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 428 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 156 ms 384 KB Output is correct
5 Correct 37 ms 504 KB Output is correct
6 Correct 649 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 925 ms 456 KB Output is correct
2 Correct 2528 ms 760 KB Output is correct
3 Correct 2904 ms 760 KB Output is correct
4 Correct 2709 ms 640 KB Output is correct