Advertisement
Anik_Akash

uri 1318 Fake Tickets

Jul 14th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. //thanks God For Every Thing!
  2. //contest link:
  3. #include<bits/stdc++.h>
  4. #define pi                      acose(-1)
  5.  
  6. typedef long long int           ll;
  7. typedef double                  dl;
  8. using namespace std;
  9. const int mx = 1e2+5;
  10.  
  11.  
  12. int main()
  13. {
  14.     int n, m;
  15.     while(cin>>n>>m && n!=0 && m!=0)
  16.     {
  17.         int a[m], i, cnt=0;
  18.         for(i=0; i<m; i++)
  19.         {
  20.             cin>>a[i];
  21.         }
  22.         int x, j;
  23.         for(x=0; x<m; x++)
  24.         {
  25.             if((a[x]!=-1) && a[x+2]!= a[x+3])
  26.             {
  27.                 for(j=x+1; j<m; j++)
  28.                 {
  29.                     if(a[x]==a[j])
  30.                     {
  31.                         cnt++;
  32.                         a[j]=-1;
  33.                         break;
  34.                     }
  35.  
  36.                 }
  37.             }
  38.  
  39.         }
  40.         cout<<cnt<<endl;
  41.     }
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement