fork download
  1. ////***************Copy Right 2021 < BUNNY /> *********************////
  2. //////************* ولسوف يعطيك ربك فترضي *****************/
  3. // Sometimes, the questions are complicated - and the answers are simple. //
  4. ///////*********************** (ACPC Next Year) *************************////
  5. #include <bits/stdc++.h>
  6.  
  7. using namespace std;
  8. typedef long long ll;
  9. #define f first
  10. #define s second
  11. #define Ya_Rab_Accepted ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  12.  
  13. void LoL_Code_Bela_Hadaf_() {
  14. #ifndef ONLINE_JUDGE
  15. freopen("in.txt", "r", stdin);
  16. freopen("out.txt", "w", stdout);
  17. #endif
  18. }
  19.  
  20. int MOD = 1e9 + 7;
  21. const long long INF = 1e18, N = 1e6+100;
  22. int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
  23. int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
  24. vector<int>adj[N];
  25. int color[N];
  26. void dfs(int node){
  27. for(auto child : adj[node]){
  28. if(color[child] == -1){
  29. color[child] = !color[node];
  30. dfs(child);
  31. }
  32. }
  33. }
  34.  
  35. int main() {
  36. Ya_Rab_Accepted
  37. LoL_Code_Bela_Hadaf_();
  38.  
  39.  
  40. int t, tc = 0; cin>>t;
  41.  
  42. while(t--){
  43. tc++;
  44. memset(color, -1, sizeof color);
  45. for(auto i : adj)
  46. i.clear();
  47. int n, m;
  48. cin>>n>>m;
  49. vector<pair<int, int>>edges(m+1);
  50. for(int i = 0;i<m;i++){
  51. int x, y;
  52. cin>>x>>y;
  53. adj[x].push_back(y);
  54. adj[y].push_back(x);
  55. edges.push_back({x, y});
  56. }
  57. for(int i = 1;i<=n;i++){
  58. if(color[i] == -1){
  59. dfs(i);
  60. }
  61. }
  62.  
  63.  
  64.  
  65. bool flag = false;
  66. for(auto i : edges){
  67. flag |= (color[i.f] == color[i.s]);
  68. }
  69.  
  70. cout<<"Scenario #"<<tc<<":\n";
  71. if(flag)
  72. cout<<"Suspicious bugs found!\n";
  73. else
  74. cout<<"No suspicious bugs found!\n";
  75.  
  76. }
  77.  
  78.  
  79.  
  80.  
  81. return 0;
  82.  
  83. }
Runtime error #stdin #stdout 0.01s 30752KB
stdin
Standard input is empty
stdout
Standard output is empty