Submission #40756

# Submission time Handle Problem Language Result Execution time Memory
40756 2018-02-08T04:56:06 Z Just_Solve_The_Problem Gap (APIO16_gap) C++11
Compilation error
0 ms 0 KB
#include <gap.h>

#define ll long long
#define pb push_back

ll findGap(int t, int n) {
		ll left;
		ll right;
		left = 1;
		right = 1e18;
		ll mn, mx;
		vector < ll > vec;
		while (mn != mx) {
			MinMax(left, right, mn, mx);
			vec.pb(mn); 
			if (mn != mx)
				vec.pb(mx);
		}
		sort(vec.begin(), vec.end());
		ll 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:12:3: error: 'vector' was not declared in this scope
   vector < ll > vec;
   ^
gap.cpp:3:12: error: expected primary-expression before 'long'
 #define ll long long
            ^
gap.cpp:12:12: note: in expansion of macro 'll'
   vector < ll > vec;
            ^
gap.cpp:14:30: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(left, right, mn, mx);
                              ^
In file included from gap.cpp:1: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:14:30: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(left, right, mn, mx);
                              ^
In file included from gap.cpp:1: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:15:4: error: 'vec' was not declared in this scope
    vec.pb(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:22:38: error: 'max' was not declared in this scope
    ans = max(ans, vec[i] - vec[i - 1]);
                                      ^