Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///HELLO THERE~!
- ///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)
- #include <bits/stdc++.h>
- #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- #define read freopen("blue.txt","r",stdin);
- #define write freopen("red.txt","w",stdout);
- #define pie 2*acos(0.0);
- typedef long long ll;
- using namespace std;
- int main()
- {
- int T;
- cin>>T;
- for(int k=0;k<T;k++)
- {
- cout<<"Case "<<k+1<<": ";
- int n;
- cin>>n;
- set<int>sivan;
- int count=0;
- int x[n+1];
- for(int i=0;i<n;i++)
- cin>>x[i];
- for(int i=0;i<n;i++)
- {
- if(x[i]==2)
- {
- count=count+sivan.size();
- sivan.clear();
- }
- else
- {
- sivan.insert(x[i]);
- }
- }
- cout<<count<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment