fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5. #include <stdio.h>
  6. using namespace std;
  7. int main()
  8. {
  9. int k=0;;
  10. vector <string> s;
  11. string s1,s2;
  12. int testcase,i,j;
  13. long int n;
  14. scanf("%d",&testcase);
  15. scanf("%ld",&n);
  16. for(i=0;i<testcase;i++)
  17. {
  18. for(j=0;j<n;j++)
  19. {
  20. int fr=2;
  21. cin >> s1 >> s2;
  22. if(j>0)
  23. {
  24. vector <string>::iterator si;
  25. for(si=s.begin();si!=s.end();si++)
  26. {
  27. k++;
  28. if((*si==s1)||(*si==s2))
  29. fr+=m[k];
  30. s.push_back(s1);
  31. s.push_back(s2);
  32. m[j]=fr-1;
  33. printf("%d\n",fr);
  34. }
  35. }
  36. return 0;
  37. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
3
Fred Barney
Barney Betty
Betty Wilma
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:29: error: ‘m’ was not declared in this scope
prog.cpp:32: error: ‘m’ was not declared in this scope
prog.cpp:37: error: expected `}' at end of input
prog.cpp:37: error: expected `}' at end of input
prog.cpp:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
prog.cpp:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
stdout
Standard output is empty