sivan_iut

Untitled

Apr 21st, 2020
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. ///HELLO THERE~!
  2. ///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)
  3.  
  4. #include <bits/stdc++.h>
  5.  
  6. #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  7. #define read freopen("blue.txt","r",stdin);
  8. #define write freopen("red.txt","w",stdout);
  9. #define pie 2*acos(0.0);
  10.  
  11. typedef long long ll;
  12.  
  13. using namespace std;
  14.  
  15.  
  16. int main()
  17.  
  18. {
  19.  
  20.    int T;
  21.    cin>>T;
  22.  
  23.    for(int k=0;k<T;k++)
  24.    {
  25.        cout<<"Case "<<k+1<<": ";
  26.  
  27.        int n;
  28.        cin>>n;
  29.  
  30.        set<int>sivan;
  31.  
  32.        int count=0;
  33.        int x[n+1];
  34.        for(int i=0;i<n;i++)
  35.         cin>>x[i];
  36.  
  37.        for(int i=0;i<n;i++)
  38.        {
  39.         if(x[i]==2)
  40.         {
  41.  
  42.             count=count+sivan.size();
  43.             sivan.clear();
  44.         }
  45.         else
  46.         {
  47.             sivan.insert(x[i]);
  48.         }
  49.        }
  50.        cout<<count<<endl;
  51.  
  52.  
  53.    }
  54.     return 0;
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment