# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
4170 | pl0892029 | Jogging (kriii1_J) | C++98 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
typedef struct point {
int x,y;
}point;
bool cmp(point a,point b) {
return a.x == b.x ? a.y > b.y : a.x < b.x;
}
point star[100000], DEQ[100000];
int Mx[100000];
double Mans[100000];
int main() {
int n, m;
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++) {
int x, y;
scanf("%d %d",&x,&y);
star[i].x=x;
star[i].y=y;
}
sort(star,star+n,cmp);
for(int i=0;i<m;i++)
scanf("%d",Mx+i);
int j = n-1;
int front = 0, rear = -1;
for(int i=m-1;i>=0;i--) {
for( ; j >= 0 && Mx[i] < star[j].x; j--) {
while( front <= rear ) {
if( DEQ[rear].y <= star[j].y )
rear--;
else
break;
}
while( front < rear ) {
if( (long long)(DEQ[rear].y-star[j].y)*(DEQ[rear-1].x-star[j].x) <=
(long long)(DEQ[rear-1].y-star[j].y)*(DEQ[rear].x-star[j].x) ) {
rear--;
}
else
break;
}
++rear;
DEQ[rear].x = star[j].x;
DEQ[rear].y = star[j].y;
}
while( front < rear ) {
if( (long long)DEQ[rear].y*(DEQ[rear-1].x-Mx[i]) <=
(long long)DEQ[rear-1].y*(DEQ[rear].x-Mx[i]) ) {
rear--;
}
else
break;
}
while( front < rear ) {
if( (long long)DEQ[front+1].y*(DEQ[front].x-Mx[i]) <=
(long long)DEQ[front].y*(DEQ[front+1].x-Mx[i]) ) {
DEQ[front+1].x = DEQ[front].x;
DEQ[front+1].y = DEQ[front].y;
front++;
}
else
break;
}
if( rear < front )
Mans[i] = 0;
else
Mans[i] = atan((double)DEQ[rear].y/(DEQ[rear].x-Mx[i]));
}
for(int i=0;i<m;i++)
printf("%.7lf\n",Mans[i]);
}
Compilation message (stderr)
J.cpp:1:1: error: 'include' does not name a type In file included from /usr/include/c++/4.6/bits/stl_pair.h:60:0, from /usr/include/c++/4.6/utility:71, from /usr/include/c++/4.6/algorithm:61, from J.cpp:2: /usr/include/c++/4.6/bits/move.h:134:26: error: 'size_t' has not been declared /usr/include/c++/4.6/bits/move.h: In function 'void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])': /usr/include/c++/4.6/bits/move.h:138:12: error: 'size_t' was not declared in this scope /usr/include/c++/4.6/bits/move.h:138:19: error: expected ';' before '__n' /usr/include/c++/4.6/bits/move.h:138:28: error: '__n' was not declared in this scope In file included from /usr/include/c++/4.6/bits/stl_algobase.h:66:0, from /usr/include/c++/4.6/algorithm:62, from J.cpp:2: /usr/include/c++/4.6/bits/stl_iterator_base_types.h: At global scope: /usr/include/c++/4.6/bits/stl_iterator_base_types.h:117:67: error: expected type-specifier before 'ptrdiff_t' /usr/include/c++/4.6/bits/stl_iterator_base_types.h:117:67: error: expected '>' before 'ptrdiff_t' /usr/include/c++/4.6/bits/stl_iterator_base_types.h:128:15: error: '_Pointer' does not name a type /usr/include/c++/4.6/bits/stl_iterator_base_types.h:130:15: error: '_Reference' does not name a type /usr/include/c++/4.6/bits/stl_iterator_base_types.h:180:15: error: 'ptrdiff_t' does not name a type /usr/include/c++/4.6/bits/stl_iterator_base_types.h:191:15: error: 'ptrdiff_t' does not name a type In file included from /usr/include/c++/4.6/bits/stl_algobase.h:68:0, from /usr/include/c++/4.6/algorithm:62, from J.cpp:2: /usr/include/c++/4.6/bits/stl_iterator.h:102:69: error: wrong number of template arguments (5, should be 3) /usr/include/c++/4.6/bits/stl_iterator_base_types.h:119:12: error: provided for 'template<class _Category, class _Tp, class _Distance> struct std::iterator' /usr/include/c++/4.6/bits/stl_iterator.h:397:66: error: wrong number of template arguments (5, should be 3) /usr/include/c++/4.6/bits/stl_iterator_base_types.h:119:12: error: provided for 'template<class _Category, class _Tp, class _Distance> struct std::iterator' /usr/include/c++/4.6/bits/stl_iterator.h:488:66: error: wrong number of template arguments (5, should be 3) /usr/include/c++/4.6/bits/stl_iterator_base_types.h:119:12: error: provided for 'template<class _Category, class _Tp, class _Distance> struct std::iterator' /usr/include/c++/4.6/bits/stl_iterator.h:582:66: error: wrong number of template arguments (5, should be 3) /usr/include/c++/4.6/bits/stl_iterator_base_types.h:119:12: error: provided for 'template<class _Category, class _Tp, class _Distance> struct std::iterator' In file included from /usr/include/c++/4.6/algorithm:62:0, from J.cpp:2: /usr/include/c++/4.6/bits/stl_algobase.h: In static member function 'static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*)': /usr/include/c++/4.6/bits/stl_algobase.h:364:10: error: 'ptrdiff_t' does not name a type /usr/include/c++/4.6/bits/stl_algobase.h:365:8: error: '_Num' was not declared in this scope /usr/include/c++/4.6/bits/stl_algobase.h:367:22: error: '_Num' was not declared in this scope /usr/include/c++/4.6/bits/stl_algobase.h: In static member function 'static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*)': /usr/include/c++/4.6/bits/stl_algobase.h:559:10: error: 'ptrdiff_t' does not name a type /usr/include/c++/4.6/bits/stl_algobase.h:560:8: error: '_Num' was not declared in this scope /usr/include/c++/4.6/bits/stl_algobase.h:562:22: error: '_Num' was not declared in this scope /usr/include/c++/4.6/bits/stl_algobase.h: In static member function 'static bool std::__lexicographical_compare<true>::__lc(const _Tp*, const _Tp*, const _Up*, const _Up*)': /usr/include/c++/4.6/bits/stl_algobase.h:897:10: error: 'size_t' does not name a type /usr/include/c++/4.6/bits/stl_algobase.h:898:10: error: 'size_t' does not name a type /usr/include/c++/4.6/bits/stl_algobase.h:900:16: error: '__len1' was not declared in this scope /usr/include/c++/4.6/bits/stl_algobase.h:900:24: error: '__len2' was not declared in this scope In file included from /usr/include/c++/4.6/bits/stl_construct.h:61:0, from /usr/include/c++/4.6/bits/stl_tempbuf.h:61, from /usr/include/c++/4.6/bits/stl_algo.h:64, from /usr/include/c++/4.6/algorithm:63, from J.cpp:2: /usr/include/c++/4.6/new: At global scope: /usr/include/c++/4.6/new:93:31: error: declaration of 'operator new' as non-function /usr/include/c++/4.6/new:93:20: error: 'size_t' is not a member of 'std' /usr/include/c++/4.6/new:93:20: note: suggested alternative: /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:212:23: note: 'size_t' /usr/include/c++/4.6/new:94:33: error: declaration of 'operator new []' as non-function /usr/include/c++/4.6/new:94:22: error: 'size_t' is not a member of 'std' /usr/include/c++/4.6/new:94:22: note: suggested alternative: /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:212:23: note: 'size_t' /usr/include/c++/4.6/new:97:25: error: declaration of 'operator new' as non-function /usr/include/c++/4.6/new:97:20: error: 'size_t' is not a member of 'std' /usr/include/c++/4.6/new:97:20: note: suggested alternative: /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:212:23: note: 'size_t' /usr/include/c++/4.6/new:97:33: error: expected primary-expression before 'const' /usr/include/c++/4.6/new:98:27: error: declaration of 'operator new []' as non-function /usr/include/c++/4.6/new:98:22: error: 'size_t' is not a member of 'std' /usr/include/c++/4.6/new:98:22: note: suggested alternative: /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:212:23: note: 'size_t' /usr/include/c++/4.6/new:98:35: error: expected primary-expression before 'const' /usr/include/c++/4.6/new:103:32: error: declaration of 'operator new' as non-function /usr/include/c++/4.6/new:103:27: error: 'size_t' is not a member of 'std' /usr/include/c++/4.6/new:103:27: note: suggested alternative: /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:212:23: note: 'size_t' /usr/include/c++/4.6/new:103:40: error: expected primary-expression before 'void' /usr/include/c++/4.6/new:104:34: error: declaration of 'operator new []' as non-function /usr/include/c++/4.6/new:104:29: error: 'size_t' is not a member of 'std' /usr/include/c++/4.6/new:104:29: note: suggested alternative: /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h:212:23: note: 'size_t' /usr/include/c++/4.6/new:104:42: error: expected primary-expression before 'void' In file included from /usr/include/c++/4.6/bits/stl_algo.h:64:0, from /usr/include/c++/4.6/algorithm:63, from J.cpp:2: /usr/include/c++/4.6/bits/stl_tempbuf.h:85:16: error: 'ptrdiff_t' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h:85:25: error: template argument 2 is invalid /usr/include/c++/4.6/bits/stl_tempbuf.h:86:25: error: invalid type in declaration before '(' token /usr/include/c++/4.6/bits/stl_tempbuf.h:86:25: error: template declaration of 'int std::get_temporary_buffer' /usr/include/c++/4.6/bits/stl_tempbuf.h:86:26: error: 'ptrdiff_t' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h:132:15: error: 'ptrdiff_t' does not name a type /usr/include/c++/4.6/bits/stl_tempbuf.h:135:7: error: 'size_type' does not name a type /usr/include/c++/4.6/bits/stl_tempbuf.h:136:7: error: 'size_type' does not name a type /usr/include/c++/4.6/bits/stl_tempbuf.h:141:7: error: 'size_type' does not name a type /usr/include/c++/4.6/bits/stl_tempbuf.h:146:7: error: 'size_type' does not name a type /usr/include/c++/4.6/bits/stl_tempbuf.h: In member function 'std::_Temporary_buffer<_ForwardIterator, _Tp>::value_type* std::_Temporary_buffer<_ForwardIterator, _Tp>::end()': /usr/include/c++/4.6/bits/stl_tempbuf.h:158:28: error: '_M_len' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h: In destructor 'std::_Temporary_buffer<_ForwardIterator, _Tp>::~_Temporary_buffer()': /usr/include/c++/4.6/bits/stl_tempbuf.h:168:39: error: '_M_len' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h: In constructor 'std::_Temporary_buffer<_ForwardIterator, _Tp>::_Temporary_buffer(_ForwardIterator, _ForwardIterator)': /usr/include/c++/4.6/bits/stl_tempbuf.h:247:7: error: class 'std::_Temporary_buffer<_ForwardIterator, _Tp>' does not have any field named '_M_original_len' /usr/include/c++/4.6/bits/stl_tempbuf.h:248:7: error: class 'std::_Temporary_buffer<_ForwardIterator, _Tp>' does not have any field named '_M_len' /usr/include/c++/4.6/bits/stl_tempbuf.h:252:23: error: 'size_type' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h:252:32: error: template argument 2 is invalid /usr/include/c++/4.6/bits/stl_tempbuf.h:252:37: error: invalid type in declaration before '(' token /usr/include/c++/4.6/bits/stl_tempbuf.h:252:38: error: 'get_temporary_buffer' is not a member of 'std' /usr/include/c++/4.6/bits/stl_tempbuf.h:253:20: error: expected primary-expression before '>' token /usr/include/c++/4.6/bits/stl_tempbuf.h:253:22: error: '_M_original_len' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h:254:20: error: request for member 'first' in '__p', which is of non-class type 'int' /usr/include/c++/4.6/bits/stl_tempbuf.h:255:4: error: '_M_len' was not declared in this scope /usr/include/c++/4.6/bits/stl_tempbuf.h:255:17: error: request for member 'second' in '__p', which is of non-class type 'int' /usr/include/c++/4.6/bits/stl_tempbuf.h:264:4: error: '_M_len' was not declared in this scope J.cpp: In function 'int main()': J.cpp:21:21: error: 'scanf' was not declared in this scope J.cpp:86:27: error: 'printf' was not declared in this scope In file included from /usr/include/c++/4.6/bits/stl_algo.h:63:0, from /usr/include/c++/4.6/algorithm:63, from J.cpp:2: /usr/include/c++/4.6/bits/stl_heap.h: In function 'void std::make_heap(_RAIter, _RAIter, _Compare) [with _RAIter = point*, _Compare = bool (*)(point, point)]': /usr/include/c++/4.6/bits/stl_algo.h:1916:7: instantiated from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = point*, _Compare = bool (*)(point, point)]' /usr/include/c++/4.6/bits/stl_algo.h:5295:7: instantiated from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = point*, _Compare = bool (*)(point, point)]' /usr/include/c++/4.6/bits/stl_algo.h:2301:8: instantiated from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = point*, _Size = long int, _Compare = bool (*)(point, point)]' /usr/include/c++/4.6/bits/stl_algo.h:5445:4: instantiated from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = point*, _Compare = bool (*)(point, point)]' J.cpp:30:22: instantiated from here /usr/include/c++/4.6/bits/stl_heap.h:421:4: error: no type named 'difference_type' in 'struct std::iterator_traits<point*>' /usr/include/c++/4.6/bits/stl_heap.h: In function 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = point*, _Compare = bool (*)(point, point)]': /usr/include/c++/4.6/bits/stl_algo.h:1919:4: instantiated from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = point*, _Compare = bool (*)(point, point)]' /usr/include/c++/4.6/bits/stl_algo.h:5295:7: instantiated from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = point*, _Compare = bool (*)(point, point)]' /usr/include/c++/4.6/bits/stl_algo.h:2301:8: instantiated from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = point*, _Size = long int, _Compare = bool (*)(point, point)]' /usr/include/c++/4.6/bits/stl_algo.h:5445:4: instantiated from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = point*, _Compare = bool (*)(point, point)]' J.cpp:30:22: instantiated from here /usr/include/c++/4.6/bits/stl_heap.h:330:2: error: no type named 'difference_type' in 'struct std::iterator_traits<point*>'