{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

1100 - #include#include using namespace...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<stack> using namespace std; // å°°é°ºiè¡ ±,å°lé°ºi+1è¡ °,å#ªå°¯è°½ä¼°å½±å fl “ 尰丯ä¸Zè¡° enum { SIZ = 4096, }; struct Node{ unsigned cur:12; unsigned nex:12; unsigned fir:4; // first bit is zero }; unsigned long long mat[12][12]; unsigned long long tab[2][SIZ]; unsigned long long *pre, *cur, *tmp; int n, m; i // return true for bit p is 1, false other wise; bool inline bittest(unsigned v, int p){ return ((v>>p)&0x01); } bool inline check_duo(int s, int b){ for(int i=0; i<b; i++){ if(bittest(s, i)) continue; if(i==b-1 || bittest(s, i+1)){ return false; } else { i++; } } return true; } int firstZero(unsigned v, int b){ for(int i=0; i<b; i++){ if(!bittest(v, i)) return i; } return b; } long long query(int a, int b){ int lim = (1<<b), i, j; Node one, non; pre = tab[0], cur = tab[1]; for(i=0; i<lim; i++){ pre[i] = check_duo(i, b); } for(j=1; j<a; j++){ memset(cur, 0, sizeof(cur[0])*lim);
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern