SHARE
TWEET

Untitled

a guest May 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h>
  4. #include <cmath>
  5. #include <queue>
  6. #include <iomanip>
  7. #include <algorithm>
  8. #include <vector>
  9. #include <set>
  10. #include <stack>
  11. #include <map>
  12. #include <deque>
  13. #include <cstring>
  14.  
  15. #define f first
  16. #define s second
  17. #define ll long long
  18. #define pb push_back
  19. #define all(x) x.begin(),x.end()
  20. #define mp make_pair
  21. #define y0 wefkljekfjwek
  22. #define y1 wdfefkljekfjwek
  23. #define y2 rfwdfefkljekfjwek
  24.  
  25. using namespace std;
  26.  
  27. const int N=100004;
  28. const long double PI=acos(-1.0);
  29. const long double EPS=1e-9;
  30.  
  31. long double n,w,v;
  32. long double ang[N];
  33. long double x[N];
  34. int t[N];
  35. int ans=0;
  36. vector<int> same[N];
  37.  
  38. void new_test()
  39. {
  40.     ans=0;
  41.     for(int i=0;i<N;i++)
  42.         same[i].clear();
  43. }
  44.  
  45. long double to_rad(int x)
  46. {
  47.     return 1.0*x*PI/(60*180);
  48. }
  49.  
  50. void process(vector<int> id)
  51. {
  52.     if(w>v*t[id[0]])
  53.         return;
  54.  
  55.     long double cur_vy = 1.0*w/t[id[0]];
  56.    
  57.     long double mx_vx=v*cos(asin(1.0*cur_vy/v));
  58.    
  59.     long double max_dif=mx_vx*t[id[0]];
  60.  
  61.     vector<long double> pts,st,ed;
  62.    
  63.     for(int i=0;i<id.size();i++)
  64.     {
  65.         int cur=id[i];
  66.        
  67.         pair<long double,long double> seg;
  68.        
  69.         seg.f=x[cur];
  70.         long double dx=w*1.0/tan(to_rad(abs(ang[cur])));
  71.        
  72.         if(ang[cur]<0)
  73.             seg.s=x[cur]-dx;
  74.         else
  75.             seg.s=x[cur]+dx;
  76.        
  77.         if(seg.f>seg.s)
  78.             swap(seg.f,seg.s);
  79.         pts.pb(seg.f);
  80.         pts.pb(seg.s);
  81.        
  82.         st.pb(seg.f);
  83.         ed.pb(seg.s);
  84.     }
  85.    
  86.     sort(all(pts));
  87.     sort(all(st));
  88.     sort(all(ed));
  89.    
  90.     for(int i=0;i<pts.size();i++)
  91.     {
  92.         int cnt1=(int)(lower_bound(all(ed),pts[i]-EPS)-ed.begin());
  93.         int cnt2=(int)st.size()-(int)(lower_bound(all(st),pts[i]+EPS+max_dif)-st.begin());
  94.         int bad=cnt1+cnt2;
  95.         ans=max(ans,(int)id.size()-bad);
  96.     }
  97. }
  98.  
  99. int main()
  100. {
  101.     ios_base::sync_with_stdio(0);
  102.     //freopen("INPUT.txt","r",stdin);
  103.    
  104.     int T;
  105.     cin>>T;
  106.     while(T--)
  107.     {
  108.         cin>>n>>w>>v;
  109.         for(int i=0;i<n;i++)
  110.         {
  111.             cin>>x[i]>>t[i]>>ang[i];
  112.             same[t[i]].pb(i);
  113.         }
  114.         for(int i=0;i<N;i++)
  115.             if(same[i].size())
  116.                 process(same[i]);
  117.         cout<<ans<<endl;
  118.        
  119.         new_test();
  120.     }
  121. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top