fork(1) download
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <algorithm>
  4. #include <string.h>
  5. #include <cmath>
  6. #include <set>
  7. #include <cstdlib>
  8. #include <cstring>
  9. #include <ctype.h>
  10. #include <map>
  11. using namespace std;
  12.  
  13.  
  14. /*long long int fact(long long int a)
  15. {
  16. if(a==0||a==1)
  17. return 1;
  18. else
  19. {
  20. long long int ans=1;
  21. for(long long int i=a;i>=1;i--)
  22. {
  23. ans=(ans%1000000007)*(i%1000000007);
  24. ans=(ans%1000000007);
  25. }
  26. return ans;
  27. }
  28. }
  29.  
  30. int cmpfunc (const void * a, const void * b)
  31. {
  32.   if( *(long long int*)a - *(long long int*)b < 0 )
  33.   return -1;
  34.   if( *(long long int*)a - *(long long int*)b > 0 )
  35.   return 1;
  36.   if( *(long long int*)a - *(long long int*)b == 0 )
  37.   return 0;
  38. }*/
  39. int a[100000];
  40.  
  41. int main()
  42. {
  43. long long int t;
  44. cin>>t;
  45. while(t--)
  46. {
  47. getchar();
  48. long long int n,k;
  49. cin>>n>>k;
  50. for(long long int i=1;i<=n;i++)
  51. a[i]=0;
  52. for(long long int i=0;i<k;i++)
  53. {
  54. long long int weight;
  55. cin>>weight;
  56. long int left[10000],right[10000];
  57. for(long long int j=0;j<weight;j++)
  58. cin>>left[j];
  59. for(long long int j=0;j<weight;j++)
  60. cin>>right[j];
  61. char comp;
  62. cin>>comp;
  63. if(comp=='=')
  64. {
  65. for(long long int k=0;k<weight;k++)
  66. {
  67. a[left[k]]=1;
  68. a[right[k]]=1;
  69. }
  70. }
  71. //else if ()
  72. }
  73. long long int ans=0,count=0;
  74. for(long long int i=1;i<=n;i++)
  75. {
  76. if(a[i]==0)
  77. {
  78. count++;
  79. ans=i;
  80. }
  81. }
  82. if(count==1)
  83. cout<<ans<<endl;
  84. else
  85. cout<<0<<endl
  86. }
  87. return 0;
  88. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:86:2: error: expected ';' before '}' token
  }
  ^
stdout
Standard output is empty