Submission
Status:
[PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: 12345678
Problemset: Bored Cat
Language: cpp
Time: 0.013 second
Submitted On: 2025-10-06 19:50:57
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=1e5+5;
ll n, k, a[nx], cnt=1, mx=1;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++) cin>>a[i];
for (int i=2; i<n; i++)
{
a[i+1]+=a[i-1]-a[i];
a[i]=a[i-1];
}
if (a[n]==a[n-1]||(n%2)) cout<<n;
else cout<<n-1;
}