QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#100473#5106. Islands from the SkyuphargaurCompile Error//C++202.4kb2023-04-26 15:07:272023-04-26 15:07:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-26 15:07:28]
  • 评测
  • [2023-04-26 15:07:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define FOR(i,n) for(int i=0;i<n;i++)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second

const int MOD = (int)1e9+7;

template <class T> int sgn(T x) { return (x > 0) - (x < 0); }

// Template class for a 2D point
template<class T>
struct Point {
    typedef Point P;
    T x, y;
    explicit Point(T x=0, T y=0) : x(x), y(y) {}
    bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
    bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
    P operator+(P p) const { return P(x+p.x, y+p.y); }
    P operator-(P p) const { return P(x-p.x, y-p.y); }
    P operator*(T d) const { return P(x*d, y*d); }
    P operator/(T d) const { return P(x/d, y/d); }
    T dot(P p) const { return x*p.x + y*p.y; }
    T cross(P p) const { return x*p.y - y*p.x; }
    T cross(P a, P b) const { return (a-*this).cross(b-*this); }
    T dist2() const { return x*x + y*y; }
    double dist() const { return sqrt((double)dist2()); }
    // angle to x-axis in interval [-pi, pi]
    double angle() const { return atan2(y, x); }
    P unit() const { return *this/dist(); } // makes dist()=1
    P perp() const { return P(-y, x); } // rotates +90 degrees
    P normal() const { return perp().unit(); }
    // returns point rotated 'a' radians ccw around the origin
    P rotate(double a) const {
        return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
    friend ostream& operator<<(ostream& os, P p) {
        return os << "(" << p.x << "," << p.y << ")"; }
};

typedef Point<double> P;

// Class for a polygon
struct Polygon{
    vector<P> points;
    Polygon(){}
    void add(P p){
        points.pb(p);
    }
};

// Constant epsilon value for comparing floating point numbers
double const eps = 1e-7;

// Function to compute the distance between a point and a line segment
double segDist(P& s, P& e, P& p) {
    if (s==e) return (p-s).dist();
    auto d = (e-s).dist2(), t = min(d,max(.0,(p-s).dot(e-s)));
    return ((p-s)*d-(e-s)*t).dist()/d;
}

// Function to check if a point is inside a polygon
bool inPolygon(vector<P> &p, P a, bool strict = false) {
    int cnt = 0, n = sz(p);
    rep(i

詳細信息

answer.code:73:10: error: unterminated argument list invoking macro "rep"
   73 |     rep(i
      |          ^
answer.code: In function ‘bool inPolygon(std::vector<Point<double> >&, P, bool)’:
answer.code:73:5: error: ‘rep’ was not declared in this scope
   73 |     rep(i
      |     ^~~
answer.code:73:8: error: expected ‘}’ at end of input
   73 |     rep(i
      |        ^
answer.code:71:56: note: to match this ‘{’
   71 | bool inPolygon(vector<P> &p, P a, bool strict = false) {
      |                                                        ^
answer.code:73:8: warning: no return statement in function returning non-void [-Wreturn-type]
   73 |     rep(i
      |        ^