Submission #40758

# Submission time Handle Problem Language Result Execution time Memory
40758 2018-02-08T05:02:18 Z Just_Solve_The_Problem Gap (APIO16_gap) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <gap.h>
                               
long long findGap(int t, int n) {
		long long left;
		long long right;
		left = 1;
		right = 1e18;
		long long mn, mx;
		vector < long long > vec;
		while (mn != mx) {
			MinMax(left, right, mn, mx);
			vec.push_back(mn); 
			if (mn != mx)
				vec.push_back(mx);
			left = mn + 1;
			right= mx - 1;	
		}
		sort(vec.begin(), vec.end());
		long long ans = 0;
		for (int i = 1; i < vec.size(); i++) {
			ans = max(ans, vec[i] - vec[i - 1]);
		}
		return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:3: error: 'vector' was not declared in this scope
   vector < long long > vec;
   ^
gap.cpp:10:3: note: suggested alternative:
In file included from /usr/include/c++/5/vector:64:0,
                 from /usr/include/c++/5/bits/random.h:34,
                 from /usr/include/c++/5/random:49,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:214:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
gap.cpp:10:12: error: expected primary-expression before 'long'
   vector < long long > vec;
            ^
gap.cpp:12:30: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(left, right, mn, mx);
                              ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:12:30: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(left, right, mn, mx);
                              ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:13:4: error: 'vec' was not declared in this scope
    vec.push_back(mn); 
    ^
gap.cpp:19:8: error: 'vec' was not declared in this scope
   sort(vec.begin(), vec.end());
        ^
gap.cpp:19:30: error: 'sort' was not declared in this scope
   sort(vec.begin(), vec.end());
                              ^
gap.cpp:19:30: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:4718:5: note:   'std::sort'
     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^
gap.cpp:22:38: error: 'max' was not declared in this scope
    ans = max(ans, vec[i] - vec[i - 1]);
                                      ^
gap.cpp:22:38: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^