# Educational Codeforces Round 15 - ABC

A. Maximum Increase

```#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
using namespace std;
int a[100010];
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
int s=0,e=0,ans = 1;
for(int i=1;i<n;i++){
if(a[i]>a[i-1])
{
e++;
ans = max(e-s+1,ans);
}
else
{
s=i;e=i;
}
}
printf("%d\n",ans);
return 0;
}```

B. Powers of Two

（写的时候蠢蠢的之前没注意看数据范围= =，结果都懂得...）

```#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<map>
#define ll __int64
using namespace std;
map<ll,int>m;
ll a[100010];
int main()
{
ll e[50]={1,1};
int cnt=0;
for(int i=1;i<50;i++)
{
if((e[i-1]*2) > (1e9+1e9) ) break;
e[i] = e[i-1]*2 ;cnt++;
}
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%I64d",&a[i]);
m[a[i]]++;
}
sort(a,a+n);
ll ans = 0;
for(int i=1;i<=cnt;i++){
for(int j=0;j<n;j++){
if(a[j] >= e[i]) break;
ll x = e[i]-a[j];
if(x==a[j]) ans += ( m[x]- 1 );
else ans += m[x];
}
}
cout<<ans/2<<endl;
}```

C. Cellular Network

n 个城市， m 个塔，在一条直线上，每个塔可以给附近的城市提供网络，

```#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#define ll __int64
using namespace std;
const int maxn = 100010;
int n,m;
ll c[maxn],t[maxn], dis = 0;;
int main()
{
t[0] = -1e9;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
scanf("%I64d",&c[i]);
for(int i=1;i<=m;i++)
scanf("%I64d",&t[i]);
ll ans = 0;
for(int i=0;i<n;i++){
int l = 1, r = m;
while(l<r){
int mid = (l+r)/2;
if(t[mid]>=c[i]) r=mid;
else l = mid+1;
}
ll a2 = abs(t[l] - c[i]);
if(l-1>0){
ll a1 = abs(t[l-1]-c[i]);
ans = max(ans, min(a1,a2));
}
else ans = max(ans, a2);
}
cout<<ans<<endl;
return 0;
}```

## Codeforces Educational Codeforces Round 15 C. Cellular Network

C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line