Advertisement
sajid161

7:4

Jan 5th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t;
  6.     cin>>t;
  7.     for(int i=1;i<=t;i++)
  8.     {
  9.         int n,m;
  10.         cin>>n>>m;
  11.         map<pair<int,int>,int>mp;
  12.         while(m--)
  13.         {
  14.             int a,b;
  15.             cin>>a>>b;
  16.             mp[{a,b}]++;
  17.         }
  18.         int flg=0;
  19.         for(auto u:mp)
  20.         {
  21.             if(u.second>1)
  22.             {
  23.                 flg++;
  24.                 break;
  25.             }
  26.  
  27.         }
  28.         if(flg==0) cout<<"Scenario #"<<i<<": possible\n";
  29.         else cout<<"Scenario #"<<i<<": impossible\n";
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement