#include <bits/stdc++.h> using namespace std; #define mp(a,b) make_pair(a,b) #define ff first #define setp(a) setprecision(a)<<fixed #define ss second #define fori(v) for(int i=0; i<v; i++) #define forj(v) for(int j=0; j<v; j++) #define fork(v) for(int k=0; k<v; k++) #define forl(v) for(int l=0; l<v; l++) #define fort(v) for(int t=0; t<v; t++) #define forz(v) for(int z=0; z<v; z++) #define forx(v) for(int x=0; x<v; x++) #define fory(v) for(int y=0; y<v; y++) #define ll long long #define lll __int128 #define ld long double #define pb(a) push_back(a) #define mt make_tuple // #define cout out // #define cin in ll inf = (ll)pow(10, 9); ll modulo = 998244353; ld eps = 1e-13; ifstream in; ofstream out; const uint64_t C = ((ll)2e18 * M_PI) + 71; // large odd number const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count(); struct chash { // To use most bits rather than just the lowest ones: ll operator()(const ll x) const { return __builtin_bswap64((x^RANDOM)*C); } }; void deal(){ ll n, m; cin>>n>>m; vector<pair<ll, ll> > edg; fori(m){ ll ai, bi; cin>>ai>>bi; --ai, --bi; edg.pb(mp(ai, bi)); } reverse(edg.begin(), edg.end()); for(ll i = 1; i<=n; i++){ // cout<<endl<<endl<<endl; unordered_set<ll> good; for(ll j = 0; j<=n-i; j++){ ll num = 0; for(ll k = j; k<=j+i-1; k++){ num |= (1ll<<k); } // cout<<"we insert num "<<bitset<8>(num)<<endl; good.insert(num); } for(auto& el : edg){ ll ai = el.ff, bi = el.ss; unordered_set<ll> yen; // cout<<"edge "<<ai+1<<" "<<bi+1<<endl; for(auto& el : good){ // cout<<"we look at "<<bitset<8>(el)<<endl; ll num1 = (1ll << ai); ll num2 = (1ll << bi); if(!((num1&el) && !(num2&el))){ yen.insert(el); } if( !(num1 & el) && (num2 & el) ){ ll num = el^(num1 | num2); yen.insert(num); } } good = yen; } cout<<good.size() % 2<<' '; } } int main(){ cin.tie(0); ios_base::sync_with_stdio(0); deal(); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #include <bits/stdc++.h> using namespace std; #define mp(a,b) make_pair(a,b) #define ff first #define setp(a) setprecision(a)<<fixed #define ss second #define fori(v) for(int i=0; i<v; i++) #define forj(v) for(int j=0; j<v; j++) #define fork(v) for(int k=0; k<v; k++) #define forl(v) for(int l=0; l<v; l++) #define fort(v) for(int t=0; t<v; t++) #define forz(v) for(int z=0; z<v; z++) #define forx(v) for(int x=0; x<v; x++) #define fory(v) for(int y=0; y<v; y++) #define ll long long #define lll __int128 #define ld long double #define pb(a) push_back(a) #define mt make_tuple // #define cout out // #define cin in ll inf = (ll)pow(10, 9); ll modulo = 998244353; ld eps = 1e-13; ifstream in; ofstream out; const uint64_t C = ((ll)2e18 * M_PI) + 71; // large odd number const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count(); struct chash { // To use most bits rather than just the lowest ones: ll operator()(const ll x) const { return __builtin_bswap64((x^RANDOM)*C); } }; void deal(){ ll n, m; cin>>n>>m; vector<pair<ll, ll> > edg; fori(m){ ll ai, bi; cin>>ai>>bi; --ai, --bi; edg.pb(mp(ai, bi)); } reverse(edg.begin(), edg.end()); for(ll i = 1; i<=n; i++){ // cout<<endl<<endl<<endl; unordered_set<ll> good; for(ll j = 0; j<=n-i; j++){ ll num = 0; for(ll k = j; k<=j+i-1; k++){ num |= (1ll<<k); } // cout<<"we insert num "<<bitset<8>(num)<<endl; good.insert(num); } for(auto& el : edg){ ll ai = el.ff, bi = el.ss; unordered_set<ll> yen; // cout<<"edge "<<ai+1<<" "<<bi+1<<endl; for(auto& el : good){ // cout<<"we look at "<<bitset<8>(el)<<endl; ll num1 = (1ll << ai); ll num2 = (1ll << bi); if(!((num1&el) && !(num2&el))){ yen.insert(el); } if( !(num1 & el) && (num2 & el) ){ ll num = el^(num1 | num2); yen.insert(num); } } good = yen; } cout<<good.size() % 2<<' '; } } int main(){ cin.tie(0); ios_base::sync_with_stdio(0); deal(); } |