Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define fastread()(ios_base:: sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- fastread();
- int n;
- cin>>n;
- int ara[n+1],z=0,o=0,zc=0,oc=0,k;
- for(int i=0; i<n; i++)
- {
- cin>>ara[i];
- if(ara[i]==0)
- z++;
- else
- o++;
- }
- for(int i=0; i<n; i++)
- {
- if(ara[i]==0)
- {
- zc++;
- if(zc==z)
- {
- k=i;
- break;
- }
- }
- else
- {
- oc++;
- if(oc==o)
- {
- k=i;
- break;
- }
- }
- }
- printf("%d\n",k+1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement