Submission #142756

#TimeUsernameProblemLanguageResultExecution timeMemory
142756nekiThe Forest of Fangorn (CEOI14_fangorn)C++14
0 / 100
811 ms5360 KiB
#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 (stderr)

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);
                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...