QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#803890#9869. Horizon Scanningucup-team133#Compile Error//C++233.6kb2024-12-07 19:19:502024-12-07 19:19:51

Judging History

你现在查看的是最新测评结果

  • [2024-12-07 19:19:51]
  • 评测
  • [2024-12-07 19:19:50]
  • 提交

answer

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <random>
#include <stdio.h>
#include <fstream>
#include <functional>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <chrono>
//#include <atcoder/modint>




using namespace std;
//using namespace atcoder;



#define rep(i,n) for (int i=0;i<n;i+=1)
#define rrep(i,n) for (int i=n-1;i>-1;i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << " )\n";

template<class T>
using vec = vector<T>;
template<class T>
using vvec = vec<vec<T>>;
template<class T>
using vvvec = vec<vvec<T>>;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;


template<class T>
bool chmin(T &a, T b){
  if (a>b){
    a = b;
    return true;
  }
  return false;
}

template<class T>
bool chmax(T &a, T b){
  if (a<b){
    a = b;
    return true;
  }
  return false;
}

template<class T>
T sum(vec<T> x){
  T res=0;
  for (auto e:x){
    res += e;
  }
  return res;
}

template<class T>
void printv(vec<T> x){
  for (auto e:x){
    cout<<e<<" ";
  }
  cout<<endl;
}



template<class T,class U>
ostream& operator<<(ostream& os, const pair<T,U>& A){
  os << "(" << A.first <<", " << A.second << ")";
  return os;
}

template<class T>
ostream& operator<<(ostream& os, const set<T>& S){
  os << "set{";
  for (auto a:S){
    os << a;
    auto it = S.find(a);
    it++;
    if (it!=S.end()){
      os << ", ";
    }
  }
  os << "}";
  return os;
}

template<class T0,class T1,class T2>
ostream& operator<<(ostream& os, const tuple<T0,T1,T2>& a){
  auto [x,y,z] = a;
  os << "(" << x << ", " << y << ", " << z << ")";
  return os;
}

template<class T0,class T1,class T2,class T3>
ostream& operator<<(ostream& os, const tuple<T0,T1,T2,T3>& a){
  auto [x,y,z,w] = a;
  os << "(" << x << ", " << y << ", " << z << ", " << w  << ")";
  return os;
}

template<class T,class U>
ostream& operator<<(ostream& os, const map<U,T>& A){
  os << "map{";
  for (auto e:A){
    os << e.first;
    os << ":";
    os << e.second;
    os << ", ";
  }
  os << "}";
  return os;
}

template<class T>
ostream& operator<<(ostream& os, const vec<T>& A){	
  os << "[";
  rep(i,A.size()){
    os << A[i];
    if (i!=A.size()-1){
      os << ", ";
    }
  }
  os << "]" ;
  return os;
}




void solve(){
  int n,k;
  cin>>n>>k;

  long double pi = acos(-1);

  vec<long double> xy_theta;
  rep(i,n){
    long double x,y;
    cin>>x>>y;

    long double r = sqrt(x*x+y*y);
    x = x/r, y = y/r;

    long double theta = acos(x);
    if (0 < y){
      xy_theta.push_back(theta);
    }
    else if (y == 0){
      if (0 < x){
        xy_theta.push_back(0);
      }
      else{
        xy_theta.push_back(pi);
      }
    }
    else{
      xy_theta.push_back(2*pi-theta);
    }
  }

  sort(all(xy_theta));

  //debug(xy_theta);

  if (n == 1){
    cout << 2 * pi << "\n";
    return ;
  }

  long double ans = 0;
  rep(i,n){
    if ((i+k) < n){
      chmax(ans,xy_theta[i+k]-xy_theta[i]);
    }
    else{
      chmax(ans,xy_theta[i+k-n]+2*pi-xy_theta[i]);
    }
  }

  cout << ans << "\n";
  


}






int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  cout << setprecision(15);

  int T;
  cin>>T;
  while (T--){
    solve();
  }
}

詳細信息

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from answer.code:5:
/usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<long double, std::allocator<long double> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long double]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from answer.code:6:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~