Submission #97016

# Submission time Handle Problem Language Result Execution time Memory
97016 2019-02-13T10:41:36 Z Kastanda The Forest of Fangorn (CEOI14_fangorn) C++11
50 / 100
3000 ms 1408 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 = 205, MXN = 10004;
int n, m, W, H, A[N], B[N], X[MXN], Y[MXN];
vector < ld > Ang[N];
vector < int > LB[MXN];
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;
    for (int i = 0; i <= m; i ++)
    {
        for (int j = 1; j <= n; j ++)
        {
            ld ang = arg(complex < ld > {(ld)(X[i] - A[j]), (ld)(Y[i] - B[j])});
            LB[i].push_back(lower_bound(Ang[j].begin(), Ang[j].end(), ang) - Ang[j].begin());
            if (LB[i].back() == Ang[j].size())
                LB[i].back() = 0;
        }
        if (i > 0 && LB[i] == LB[0])
            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:39:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (LB[i].back() == Ang[j].size())
                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
fangorn.cpp:19: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:21: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:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
fangorn.cpp:24: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 512 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 4 ms 768 KB Output is correct
8 Correct 4 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 4 ms 896 KB Output is correct
4 Correct 4 ms 768 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 7 ms 1152 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 4 ms 640 KB Output is correct
10 Correct 10 ms 1280 KB Output is correct
11 Correct 11 ms 1408 KB Output is correct
12 Correct 11 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 612 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
4 Runtime error 145 ms 1400 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3013 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -