QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#73074 | #5155. Faster Than Light | Sorting# | Compile Error | / | / | C++ | 2.5kb | 2023-01-21 21:54:21 | 2023-01-21 21:54:24 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-01-21 21:54:24]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-01-21 21:54:21]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> int sgn(T x){ return (x > 0) - (x < 0); }
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);}
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);}
};
const int N = 2e5 + 3;
int n;
ll x1[N], y1[N], x2[N], y2[N];
#define all(x) (x).begin(), (x).end()
typedef Point<ll> P;
vector<P> convexHull(vector<P> pts) {
if(pts.size() <= 1) return pts;
sort(all(pts));
vector<P> h((int)pts.size() + 1);
int s = 0, t = 0;
for(int it = 2; it--; s = --t, reverse(all(pts))){
for(P p: pts){
while(t >= s + 2 && h[t - 2].cross(h[t - 1], p) <= 0) t--;
h[t++] = p;
}
}
return {h.begin(), h.begin() + t - (t == 2 && h[0] == h[1])};
}
template<class P>
int sideOf(P s, P e, P p){ return sgn(s.cross(e, p)); }
bool inHull(const vector<P> &l, P p, bool strict = true){
int a = 1, b = (int)l.size() - 1, r = !strict;
if(sideOf(l[0], l[a], l[b]) > 0) swap(a, b);
if(sideOf(l[0], l[a], p) >= r || sideOf(l[0], l[b], p) <= -r)
return false;
while(abs(a - b) > 1){
int c = (a + b) / 2;
(sideOf(l[0], l[c], p) > 0 ? b : a) = c;
}
return sgn(l[a].cross(l[b], p)) < r;
}
bool check(const vector<Point<ll>> &in, const vector<Point<ll>> &out){
vector<Point<ll>> ch = convexHull(in);
for(auto p: out){
if(inHull(ch, p, true))
return false;
}
return true;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 0; i < n; ++i)
cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
if(n <= 2){
cout << "possible\n";
return 0;
}
vector<Point<ll>> in1, in2, out1, out2;
for(int i = 0; i < n; ++i){
in1.push_back(Point<ll>(x1[i], y1[i]));
in2.push_back(Point<ll>(x1[i], y2[i]));
out1.push_back(Point<ll>(x2[i], y2[i]));
out2.push_back(Point<ll>(x2[i], y1[i]));
}
if(check(in1, out1) || check(in2, out2))
cout << "possible\n";
else
cout << "impossible\n";
}
Details
answer.code:23:15: error: ‘ll y1 [200003]’ redeclared as different kind of entity 23 | ll x1[N], y1[N], x2[N], y2[N]; | ^ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:571, from /usr/include/c++/11/cassert:43, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration ‘double y1(double)’ 221 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:74:29: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; | ^ answer.code:74:22: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’) 74 | cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; | ~~~~~~~~~~~~ ^~ ~~~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:120:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match) 120 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/11/istream:120:7: note: conversion of argument 1 would be ill-formed: answer.code:74:29: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)’ {aka ‘std::basic_istream<char>& (*)(std::basic_istream<char>&)’} [-fpermissive] 74 | cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; | ~~~~^ | | | double (*)(double) noexcept In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:124:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’ (near match) 124 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/11/istream:124:7: note: conversion of argument 1 would be ill-formed: answer.code:74:29: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’} [-fpermissive] 74 | cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; | ~~~~^ | | | double (*)(double) noexcept In file included from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/istream:131:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match) 131 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/11/istream:131:7: note: conversion of argument 1 would be ill-formed: answer.code:74:29: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::ios_base& (*)(std::ios_base&)’ [-fpermissive] 74 | cin >> x1[i] ...