| Task: | Gap |
| Sender: | Lieska |
| Submission time: | 2019-04-13 11:55:56 +0300 |
| Language: | C++ |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'll FindGap(ll, ll)':
input/code.cpp:8:27: error: 'n' was not declared in this scope
for (int i=1; i<=(n+1)/2; ++i){
^
input/code.cpp:9:27: error: 'mn' was not declared in this scope
MinMax(c, d, &mn, &mx);
^~
input/code.cpp:9:27: note: suggested alternative: 'yn'
MinMax(c, d, &mn, &mx);
^~
yn
input/code.cpp:9:32: error: 'mx' was not declared in this scope
MinMax(c, d, &mn, &mx);
^~
input/code.cpp:15:25: error: 'n' was not declared in this scope
for (int i=1; i<n; ++i){
^
input/code.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^Code
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
ll FindGap(ll a, ll b){
if (a==1){
ll c=0, d=1e18, t[100001], s=0;
for (int i=1; i<=(n+1)/2; ++i){
MinMax(c, d, &mn, &mx);
t[i]=mn;
t[n+1-i]=mx;
c=mn-1;
d=mx-1;
}
for (int i=1; i<n; ++i){
c=t[i+1]-t[i];
if (c>s) s=c;
}
return s;
}
}
