fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. #define Max 10010
  8.  
  9. vector<int> Graph[Max];
  10. int Low[Max],Num[Max],Padre_Nodo[Max];
  11. bool Visi[Max];
  12. int Act,Ans,Hijos_root,Root;
  13.  
  14. void DFS(int Padre){
  15. Low[Padre]=Num[Padre]=Act;
  16. Act++;
  17. Visi[Padre]=true;
  18. for(int i=0;i<Graph[Padre].size();i++){
  19. int Hijo=Graph[Padre][i];
  20. if(Visi[Hijo]==false){
  21. Padre_Nodo[Hijo]=Padre;
  22. DFS(Hijo);
  23. if(Padre==Root){
  24. Hijos_root++;
  25. }
  26. if(Low[Hijo]>=Num[Padre] && Padre!=Root){
  27. Ans++;
  28. }
  29. Low[Padre]=min(Low[Padre],Low[Hijo]);
  30. }else if(Padre_Nodo[Padre]!=Hijo && Padre!=Root){
  31. Low[Padre]=min(Low[Padre],Num[Hijo]);
  32. }
  33. }
  34. }
  35.  
  36. int main(){
  37. int n,m,a,b;
  38. while(cin>>n>>m){
  39. if(n==m && m==0) break;
  40. for(int i=0;i<=n;i++){
  41. Graph[i].clear();
  42. Low[i]=0;
  43. Num[i]=0;
  44. Padre_Nodo[i]=-1;
  45. Visi[i]=false;
  46. }
  47. while(m--){
  48. cin>>a>>b;
  49. Graph[a].push_back(b);
  50. Graph[b].push_back(a);
  51. }
  52. Ans=0; Act=0;
  53. for(int i=1;i<=n;i++){
  54. if(Visi[i]==false){
  55. Root=i; Hijos_root=0;
  56. DFS(Root);
  57. if(Hijos_root>=2) Ans++;
  58. }
  59. }
  60. cout<<Ans<<endl;
  61. }
  62. return 0;
  63. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
Main.java:2: error: illegal character: '#'
#include <cstdio>
^
Main.java:3: error: illegal character: '#'
#include <vector>
^
Main.java:7: error: illegal character: '#'
#define Max 10010
^
Main.java:7: error: class, interface, or enum expected
#define Max 10010
        ^
Main.java:10: error: class, interface, or enum expected
int Low[Max],Num[Max],Padre_Nodo[Max];
^
Main.java:11: error: class, interface, or enum expected
bool Visi[Max];
^
Main.java:12: error: class, interface, or enum expected
int Act,Ans,Hijos_root,Root;
^
Main.java:14: error: class, interface, or enum expected
void DFS(int Padre){
^
Main.java:16: error: class, interface, or enum expected
	Act++;
	^
Main.java:17: error: class, interface, or enum expected
	Visi[Padre]=true;
	^
Main.java:18: error: class, interface, or enum expected
	for(int i=0;i<Graph[Padre].size();i++){
	^
Main.java:18: error: class, interface, or enum expected
	for(int i=0;i<Graph[Padre].size();i++){
	            ^
Main.java:18: error: class, interface, or enum expected
	for(int i=0;i<Graph[Padre].size();i++){
	                                  ^
Main.java:20: error: class, interface, or enum expected
		if(Visi[Hijo]==false){
		^
Main.java:22: error: class, interface, or enum expected
			DFS(Hijo);
			^
Main.java:23: error: class, interface, or enum expected
			if(Padre==Root){
			^
Main.java:25: error: class, interface, or enum expected
			}
			^
Main.java:28: error: class, interface, or enum expected
			}
			^
Main.java:30: error: class, interface, or enum expected
		}else if(Padre_Nodo[Padre]!=Hijo && Padre!=Root){
		^
Main.java:32: error: class, interface, or enum expected
		}
		^
Main.java:38: error: class, interface, or enum expected
	while(cin>>n>>m){
	^
Main.java:40: error: class, interface, or enum expected
		for(int i=0;i<=n;i++){
		^
Main.java:40: error: class, interface, or enum expected
		for(int i=0;i<=n;i++){
		            ^
Main.java:40: error: class, interface, or enum expected
		for(int i=0;i<=n;i++){
		                 ^
Main.java:42: error: class, interface, or enum expected
			Low[i]=0;
			^
Main.java:43: error: class, interface, or enum expected
			Num[i]=0;
			^
Main.java:44: error: class, interface, or enum expected
			Padre_Nodo[i]=-1;
			^
Main.java:45: error: class, interface, or enum expected
			Visi[i]=false;
			^
Main.java:46: error: class, interface, or enum expected
		}
		^
Main.java:49: error: class, interface, or enum expected
			Graph[a].push_back(b);
			^
Main.java:50: error: class, interface, or enum expected
			Graph[b].push_back(a);
			^
Main.java:51: error: class, interface, or enum expected
		}
		^
Main.java:52: error: class, interface, or enum expected
		Ans=0; Act=0;
		       ^
Main.java:53: error: class, interface, or enum expected
		for(int i=1;i<=n;i++){
		^
Main.java:53: error: class, interface, or enum expected
		for(int i=1;i<=n;i++){
		            ^
Main.java:53: error: class, interface, or enum expected
		for(int i=1;i<=n;i++){
		                 ^
Main.java:55: error: class, interface, or enum expected
				Root=i; Hijos_root=0;
				        ^
Main.java:56: error: class, interface, or enum expected
				DFS(Root);
				^
Main.java:57: error: class, interface, or enum expected
				if(Hijos_root>=2) Ans++;
				^
Main.java:58: error: class, interface, or enum expected
			}
			^
Main.java:61: error: class, interface, or enum expected
	}
	^
Main.java:63: error: class, interface, or enum expected
}
^
44 errors
stdout
Standard output is empty