Bounderies At the border of state A with the state B there are N devices of defense. For each device k it is also known the length [Ak, Bk] in which they operate (border is considered to be a straight line, and each tool covers a particular segment on this line). To reduce the costs of maintenance, the head of state has decided that some of the N devices for the defense have to be dismantled. More specifically, we will dismantle redundant devices. A device i is called redundant if there is at least one device j so that the interval [Aj, Bj] includes the interval [Ai, Bi] (more explicitly, Aj < Ai and Bi < Bj). Task Find out how many of the N devices are redundant. Input On the first line of the file “granita.in” you will have an integer N, representing the number of defending devices. On the following N lines there will be pairs of two integers, a and b (a<b), representing the start and the end of the interval on which the device works (more explicitly, assuming that on line i we have a and b, then [a, b] = [Ai, Bi]). Output The file “granita.out” will contain a single line on which you will print the integer number representing the number of redundant devices. Restrictions 1 <= N <= 16.000 0 <= Ai < Bi <= 2.000.000 All integers Ai will be distinct All integers Bi will be distinct Example: Granita.in 5 0 10 2 9 3 8 1 15 6 11 Granita.out 3 |
|
|
Debug Assertion Failed! Program: [...]Granita.exe File: C:\[...]\vc\include\vector Line: 932 Expression: vector subscript out of range For information on how your program can cause an assertion failure see the Visual C++ documentation on asserts. |
|
|
|
|
user.cpp: In function ‘void processAndWrite(std::vector<Boundary, std::allocator<Boundary> >&, int&)’: user.cpp:52: error: ‘INT_MAX’ was not declared in this scope user.cpp:57: warning: comparison between signed and unsigned integer expressions user.cpp:66: warning: comparison between signed and unsigned integer expressions In file included from /usr/include/c++/4.4/algorithm:62, from user.cpp:3: /usr/include/c++/4.4/bits/stl_algo.h: In function ‘const _Tp& std::__median(const _Tp&, const _Tp&, const _Tp&) [with _Tp = Boundary]’: /usr/include/c++/4.4/bits/stl_algo.h:2268: instantiated from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Boundary*, std::vector<Boundary, std::allocator<Boundary> > >, _Size = int]’ /usr/include/c++/4.4/bits/stl_algo.h:5220: instantiated from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Boundary*, std::vector<Boundary, std::allocator<Boundary> > >]’ user.cpp:56: instantiated from here /usr/include/c++/4.4/bits/stl_algo.h:89: error: no match for ‘operator<’ in ‘__a < __b’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:90: error: no match for ‘operator<’ in ‘__b < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:92: error: no match for ‘operator<’ in ‘__a < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:96: error: no match for ‘operator<’ in ‘__a < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:98: error: no match for ‘operator<’ in ‘__b < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) |
user.cpp:52: error: ‘INT_MAX’ was not declared in this scope |
/usr/include/c++/4.4/bits/stl_algo.h: In function ‘const _Tp& std::__median(const _Tp&, const _Tp&, const _Tp&) [with _Tp = Boundary]’: /usr/include/c++/4.4/bits/stl_algo.h:2268: instantiated from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Boundary*, std::vector<Boundary, std::allocator<Boundary> > >, _Size = int]’ /usr/include/c++/4.4/bits/stl_algo.h:5220: instantiated from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Boundary*, std::vector<Boundary, std::allocator<Boundary> > >]’ user.cpp:56: instantiated from here /usr/include/c++/4.4/bits/stl_algo.h:89: error: no match for ‘operator<’ in ‘__a < __b’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:90: error: no match for ‘operator<’ in ‘__b < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:92: error: no match for ‘operator<’ in ‘__a < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:96: error: no match for ‘operator<’ in ‘__a < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) /usr/include/c++/4.4/bits/stl_algo.h:98: error: no match for ‘operator<’ in ‘__b < __c’ user.cpp:20: note: candidates are: bool operator<(Boundary&, Boundary&) |
const
, I will get an error on:
|
|
|
|