답안 #142753

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
142753 2019-08-10T17:50:56 Z neki The Forest of Fangorn (CEOI14_fangorn) C++14
0 / 100
546 ms 504 KB
#include <bits/stdc++.h>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define maxn 2010
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;

struct poi{ll x, y;};

poi ps[maxn], camps[10010];
bool can[10010];

int main() {
    ll w, h; cin >> w >> h;
    poi G;cin >> G.x >> G.y;
    ll c, n;cin >> c;
    loop(i, 0, c) scanf("%lld%lld", &camps[i].x, &camps[i].y);
    loop(i, 0, c) can[i]=1;
    cin >> n;
    loop(i, 0, n) scanf("%lld%lld", &ps[i].x, &ps[i].y);
    loop(i, 0, n){
        pair<double, ll> temp[maxn];
        loop(j, 0, n)if(j!=i) temp[j].fi=atan2(ps[j].y-ps[i].y, ps[j].x-ps[i].x), temp[j].se=j;
        temp[i].fi=atan2(G.y-ps[i].y, G.x-ps[i].x), temp[i].se=i;
        sort(temp, temp+n);
        loop(j, 0, n) if(temp[j].se==i){
            double p1=temp[(j+n-1)%n].fi, p2=temp[(j+n+1)%n].fi;
            loop(k, 0, c){
                double cmp=atan2(camps[k].y-ps[i].y, camps[k].x-ps[i].x);
                if((p1<p2 and ((cmp<p1 and cmp<p2)or(cmp>p1 and cmp>p2))) or (p1>p2 and ((cmp>p1 and cmp<p2)or(cmp>p1 and cmp<p2)))) can[k]=0;
            }
            break;
        };
    }
    ll ans=0;
    loop(i, 0, c) if(can[i]) ans++;
    cout << ans<<endl;
    loop(i, 0, c) if(can[i]) cout << i+1 << " ";
}

Compilation message

fangorn.cpp: In function 'int main()':
fangorn.cpp:19:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     loop(i, 0, c) scanf("%lld%lld", &camps[i].x, &camps[i].y);
                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fangorn.cpp:22:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     loop(i, 0, n) scanf("%lld%lld", &ps[i].x, &ps[i].y);
                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 364 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Correct 3 ms 380 KB Output is correct
8 Incorrect 3 ms 504 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 3 ms 376 KB Output isn't correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Incorrect 2 ms 380 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 3 ms 376 KB Output isn't correct
10 Incorrect 6 ms 376 KB Output isn't correct
11 Correct 5 ms 376 KB Output is correct
12 Incorrect 7 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 546 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -