QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#753514 | #9565. Birthday Gift | ucup-team4906# | Compile Error | / | / | C++20 | 2.6kb | 2024-11-16 13:07:23 | 2024-11-16 13:07:24 |
Judging History
answer
#include<bits/stdc++.h>
#define F(i, a, b) for(int i = a; i <= b; i ++)
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
typedef unsigned long long ull;
#define N 110
typedef double T;
typedef double db;
const db pi = acosl(-1);
const db eps = 1e-8;
int sgn(T x) {
if(fabs(x) < eps) return 0;
else return x < 0 ? -1 : 1;
}
struct point {
T x, y;
point() {}
point(T x, T y) : x(x), y(y) {}
point operator + (point B) const {return point(x + B.x, y + B.y);}
point operator - (point B) const {return point(x - B.x, y - B.y);}
point operator * (T k) const {return point(x * k, y * k);}
point operator / (T k) const {return point(x / k, y / k);}
bool operator == (point B) const {return sgn(x - B.x) == 0 && sgn(y - B.y) == 0;}
bool operator < (point B) const {return sgn(x - B.x) < 0 || (sgn(x - B.x) == 0 && sgn(y - B.y) < 0);}
T cross(point p) const {return x * p.y - y * p.x;}
int left(point p) const {return sgn(cross(p));}
T len() const {return sqrtl(x * x + y * y);}
point rot(long double cosr, long double sinr) {return point(x * cosr - y * sinr, x * sinr + y * cosr);}
};
T dot(point x) {return x.x * x.x + x.y * x.y;}
db dis(point A, point B) {return sqrtl((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));}
int get_region(point p) {
return sgn(p.y) < 0 ? -1 : sgn(p.y) > 0 | (sgn(p.y) == 0 & sgn(p.x) < 0);
}
bool cmp_arg(point a, point b) {
int p = get_region(a), q = get_region(b);
if(p != q) return p < q;
if(a.left(b) == 0) return dot(a) < dot(b);
return a.left(b) == 1;
}
int n, x0, y0, d, t;
point o(0, 0);
pair<point, point> tangent(const point a) {
point e = a; e = e / e.len() * d;
long double costh = d / dis(a, o), sinth = sqrtl(1 - costh * costh);
point t1 = o + e.rot(costh, -sinth), t2 = o + e.rot(costh, sinth);
// 两个切点
return {a - t1, a - t2};
}
bool cmp(pair<point, int> x1, pair<point, int> x2) {
return cmp_arg(x1.first, x2.first);
}
void sol() {
cin >> n >> x0 >> y0 >> d >> t;
vector<point> p;
vector<pair<point, int>> qaq;
F(i, 0, n - 1) {
int x, y; cin >> x >> y;
p.push_back(point(x, y));
auto [u, v] = tangent(point(x, y));
qaq.push_back({u, i}), qaq.push_back({v, i});
}
sort(qaq.begin(), qaq.end(), cmp);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
// cin >> T;
while (T --) sol();
return 0;
}
详细
answer.code:49:12: error: ‘int y0’ redeclared as different kind of entity 49 | int n, x0, y0, d, t; | ^~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679, from /usr/include/c++/13/cassert:43, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’ 220 | __MATHCALL (y0,, (_Mdouble_)); | ^~~~~~~~~~ answer.code: In function ‘void sol()’: answer.code:63:20: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’) 63 | cin >> n >> x0 >> y0 >> d >> t; | ~~~~~~~~~~~~~~ ^~ ~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:7: note: conversion of argument 1 would be ill-formed: answer.code:63:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive] 63 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:63:23: error: cannot bind rvalue ‘(void*)y0’ to ‘void*&’ /usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 201 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:201:7: note: conversion of argument 1 would be ill-formed: answer.code:63:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive] 63 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:63:23: error: cannot bind rvalue ‘(long long unsigned int)y0’ to ‘long long unsigned int&’ /usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 197 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:197:7: note: conversion of argument 1 would be ill-formed: answer.code:63:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive] 63 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:63:23: error: cannot bind rvalue ‘(long long int)y0’ to ‘long long int&’ /usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:192:7: note: conversion of argument 1 would be ill-formed: answer.code:63:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive] 63 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:63:23: error: cannot bind rvalue ‘(long unsigned int)y0’ to ‘long unsigned int&’ /usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:188:7: note: conversio...