#include "gap.h"
#include <stdio.h>
#include <vector>
#define maxN 1000000000
long long max(long long x, long long y) {return x > y ? x : y;}
long long findGap(int T, int N)
{
vector<long long> d(10000000);
long long mn, mx, s, t;
long long sol = 0, sag = maxN;
int solIn = 0, sagIn = N-1;
while (solIn < sagIn) {
// printf("Sol: %lld, sag: %lld, ", sol, sag);
s = sol, t = sag;
MinMax(s, t, &mn, &mx);
//printf("mn: %lld, mx: %lld\n", mn, mx);
d[solIn++] = sol = mn;
d[sagIn--] = sag = mx;
sol++, sag--;
}
long long fark = 0;
/* for (int i = 0; i < N; i++)
printf("%d ", d[i]);
printf("\n");
*/for (int i = 1; i < N; i++)
fark = max(fark, d[i] - d[i-1]);
return fark;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:5: error: 'vector' was not declared in this scope
vector<long long> d(10000000);
^
gap.cpp:10:5: note: suggested alternative:
In file included from /usr/include/c++/5/vector:64:0,
from gap.cpp:3:
/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> d(10000000);
^
gap.cpp:21:3: error: 'd' was not declared in this scope
d[solIn++] = sol = mn;
^
gap.cpp:32:20: error: 'd' was not declared in this scope
fark = max(fark, d[i] - d[i-1]);
^