답안 #142756

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
142756 2019-08-10T18:22:28 Z neki The Forest of Fangorn (CEOI14_fangorn) C++14
0 / 100
811 ms 5360 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;cout << c << endl;
    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[i].y-ps[j].y, ps[i].x-ps[j].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;
                cout << can[k]<<" ";
            }
            cout << endl;
            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 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 248 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 3 ms 376 KB Output isn't correct
8 Incorrect 3 ms 380 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Incorrect 3 ms 376 KB Output isn't correct
5 Incorrect 3 ms 376 KB Output isn't correct
6 Incorrect 5 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 308 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 Incorrect 6 ms 376 KB Output isn't correct
12 Incorrect 7 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 811 ms 5360 KB Output isn't correct
2 Halted 0 ms 0 KB -