fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <iomanip>
  4. #include <cmath>
  5. #include <algorithm>
  6. #include <ctime>
  7. #include <cstdlib>
  8. #include <vector>
  9. #include <sstream>
  10. #include <map>
  11. #include <set>
  12.  
  13. #define fi first
  14. #define se second
  15. #define fastio ios_base::sync_with_stdio(0);cin.tie(0);
  16.  
  17. using namespace std;
  18.  
  19. int x3[1000000];
  20. int x2[1000000];
  21. int st1[1000000];
  22. int f[100000];
  23.  
  24. vector <int> v[1000000];
  25. int h,t=0;
  26. set<int> st;
  27.  
  28. void check()
  29. {
  30. //for (int i=0; h>i; i++) cout << st[i] << " ";
  31. //cout << endl;
  32. set<int> :: iterator t=st.begin();
  33. //cout << h/2 << endl;
  34.  
  35. for (int i=0; h/2>i; i++, t++);
  36.  
  37. x2[*t]++;
  38. }
  39.  
  40. void dfs(int xx)
  41. {
  42. if (f[xx]==t) return;
  43. st.insert(xx);
  44. st1[h++]=xx;
  45. f[xx]=t;
  46. if (h%2==1) check();
  47. int m1=v[xx].size();
  48. for (int j=0; m1>j; j++) dfs(v[xx][j]);
  49. st.erase(st1[h-1]);
  50. h--;
  51. }
  52.  
  53. int main()
  54. {
  55. fastio;
  56. srand(time(0));
  57. freopen("input.txt", "r", stdin);
  58. freopen("output.txt", "w", stdout);
  59.  
  60. int n,a,b,i,j;
  61.  
  62. cin >> n;
  63. for (i=1; n>i; i++)
  64. {
  65. cin >> a >> b;
  66. v[a].push_back(b);
  67. v[b].push_back(a);
  68. }
  69.  
  70. for (i=1; n>=i; i++)
  71. {
  72. int n1=v[i].size();
  73. t++;
  74. f[i]=t;
  75. h=0;
  76. st.insert(i);
  77. st1[h++]=i;
  78. for (j=0; n1>j; j++) dfs(v[i][j]);
  79. st.clear();
  80. }
  81.  
  82. for (i=1; n>=i; i++) cout << x2[i] << endl;
  83.  
  84. return 0;
  85. }
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 <iomanip>
^
Main.java:4: error: illegal character: '#'
#include <cmath>
^
Main.java:5: error: illegal character: '#'
#include <algorithm>
^
Main.java:6: error: illegal character: '#'
#include <ctime>
^
Main.java:7: error: illegal character: '#'
#include <cstdlib>
^
Main.java:8: error: illegal character: '#'
#include <vector>
^
Main.java:9: error: illegal character: '#'
#include <sstream>
^
Main.java:10: error: illegal character: '#'
#include <map>
^
Main.java:11: error: illegal character: '#'
#include <set>
^
Main.java:13: error: illegal character: '#'
#define fi first
^
Main.java:14: error: illegal character: '#'
#define se second
^
Main.java:15: error: illegal character: '#'
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
^
Main.java:15: error: class, interface, or enum expected
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
                                            ^
Main.java:17: error: class, interface, or enum expected
using namespace std;
^
Main.java:19: error: class, interface, or enum expected
int x3[1000000];
^
Main.java:20: error: class, interface, or enum expected
int x2[1000000];
^
Main.java:21: error: class, interface, or enum expected
int st1[1000000];
^
Main.java:22: error: class, interface, or enum expected
int f[100000];
^
Main.java:24: error: class, interface, or enum expected
vector <int> v[1000000];
^
Main.java:25: error: class, interface, or enum expected
int h,t=0;
^
Main.java:26: error: class, interface, or enum expected
set<int> st;
^
Main.java:28: error: class, interface, or enum expected
void check()
^
Main.java:35: error: class, interface, or enum expected
    for (int i=0; h/2>i; i++, t++);
    ^
Main.java:35: error: class, interface, or enum expected
    for (int i=0; h/2>i; i++, t++);
                  ^
Main.java:35: error: class, interface, or enum expected
    for (int i=0; h/2>i; i++, t++);
                         ^
Main.java:37: error: class, interface, or enum expected
    x2[*t]++;
    ^
Main.java:38: error: class, interface, or enum expected
}
^
Main.java:43: error: class, interface, or enum expected
    st.insert(xx);
    ^
Main.java:44: error: class, interface, or enum expected
    st1[h++]=xx;
    ^
Main.java:45: error: class, interface, or enum expected
    f[xx]=t;
    ^
Main.java:46: error: class, interface, or enum expected
    if (h%2==1) check();
    ^
Main.java:47: error: class, interface, or enum expected
    int m1=v[xx].size();
    ^
Main.java:48: error: class, interface, or enum expected
    for (int j=0; m1>j; j++) dfs(v[xx][j]);
    ^
Main.java:48: error: class, interface, or enum expected
    for (int j=0; m1>j; j++) dfs(v[xx][j]);
                  ^
Main.java:48: error: class, interface, or enum expected
    for (int j=0; m1>j; j++) dfs(v[xx][j]);
                        ^
Main.java:49: error: class, interface, or enum expected
    st.erase(st1[h-1]);
    ^
Main.java:50: error: class, interface, or enum expected
    h--;
    ^
Main.java:51: error: class, interface, or enum expected
}
^
Main.java:56: error: class, interface, or enum expected
    srand(time(0));
    ^
Main.java:57: error: class, interface, or enum expected
    freopen("input.txt", "r", stdin);
    ^
Main.java:58: error: class, interface, or enum expected
    freopen("output.txt", "w", stdout);
    ^
Main.java:60: error: class, interface, or enum expected
    int n,a,b,i,j;
    ^
Main.java:62: error: class, interface, or enum expected
    cin >> n;
    ^
Main.java:63: error: class, interface, or enum expected
    for (i=1; n>i; i++)
    ^
Main.java:63: error: class, interface, or enum expected
    for (i=1; n>i; i++)
              ^
Main.java:63: error: class, interface, or enum expected
    for (i=1; n>i; i++)
                   ^
Main.java:66: error: class, interface, or enum expected
        v[a].push_back(b);
        ^
Main.java:67: error: class, interface, or enum expected
        v[b].push_back(a);
        ^
Main.java:68: error: class, interface, or enum expected
    }
    ^
Main.java:70: error: class, interface, or enum expected
    for (i=1; n>=i; i++)
              ^
Main.java:70: error: class, interface, or enum expected
    for (i=1; n>=i; i++)
                    ^
Main.java:73: error: class, interface, or enum expected
        t++;
        ^
Main.java:74: error: class, interface, or enum expected
        f[i]=t;
        ^
Main.java:75: error: class, interface, or enum expected
        h=0;
        ^
Main.java:76: error: class, interface, or enum expected
        st.insert(i);
        ^
Main.java:77: error: class, interface, or enum expected
        st1[h++]=i;
        ^
Main.java:78: error: class, interface, or enum expected
        for (j=0; n1>j; j++) dfs(v[i][j]);
        ^
Main.java:78: error: class, interface, or enum expected
        for (j=0; n1>j; j++) dfs(v[i][j]);
                  ^
Main.java:78: error: class, interface, or enum expected
        for (j=0; n1>j; j++) dfs(v[i][j]);
                        ^
Main.java:79: error: class, interface, or enum expected
        st.clear();
        ^
Main.java:80: error: class, interface, or enum expected
    }
    ^
Main.java:82: error: class, interface, or enum expected
    for (i=1; n>=i; i++) cout << x2[i] << endl;
              ^
Main.java:82: error: class, interface, or enum expected
    for (i=1; n>=i; i++) cout << x2[i] << endl;
                    ^
Main.java:84: error: class, interface, or enum expected
    return 0;
    ^
Main.java:85: error: class, interface, or enum expected
}
^
68 errors
stdout
Standard output is empty