Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <string>
- #include <queue>
- #include <map>
- #include <set>
- #include <cmath>
- #include <sstream>
- #include <stack>
- #include <cassert>
- #define pb push_back
- #define mp make_pair
- #define PI 3.1415926535897932384626433832795
- #define sqr(x) (x)*(x)
- #define forn(i, n) for(int i = 0; i < n; ++i)
- #define ALL(x) x.begin(), x.end()
- #define F first
- #define S second
- #define m0(x) memset(x,0,sizeof(x))
- #define CC(x) cout << (x) << "\n"
- #define pw(x) (1ull<<(x)).
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef pair<int,int> pii;
- const int INF = 2147483647;
- const ll LLINF = 9223372036854775807LL;
- int a[100500];
- int main() {
- freopen("progression.in", "r", stdin);
- freopen("progression.out", "w", stdout);
- int n;
- cin >> n;
- forn(i,n) cin >> a[i];
- int l=0;
- int r=1;
- int max=-1;
- while (l<n-1) {
- while (r+1<n && a[r+1]-a[r]==a[l+1]-a[l]) r++;
- if (r-l+1>max) max=r-l+1;
- l=r;
- }
- CC(max);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment