全部评论 1

  • ITE了

    1周前 来自 上海

    0
    • TLE

      1周前 来自 上海

      0
    • #include <iostream>
      #include <algorithm>
      #include <vector>
      #define int long long
      #define BUFSIZE 10000000
      struct read {
          char buf[BUFSIZE], *p1, *p2, c;
          read(): p1(buf), p2(buf) {}
          char gc(void) {
              return p1 == p2 && (p2 = buf + fread(p1 = buf, 1, BUFSIZE, stdin), p1 == p2) ? EOF : *p1++;
          }
          read &operator >>(unsigned &x) {
              for (c = gc(), x = 0; c < '0' || c > '9'; c = gc());
      
              for (; c >= '0' && c <= '9'; c = gc())
                  x = x * 10 + (c - '0');
      
              return *this;
          }
      } cin;
      struct write {
          char buf[BUFSIZE], *p1, *p2;
          write(): p1(buf), p2(buf + BUFSIZE) {}
          ~write() {
              fwrite(buf, 1, p1 - buf, stdout);
          }
          void pc(char c) {
              p1 == p2 &&(fwrite(buf, 1, p1 - buf, stdout), p1 = buf), *p1++ = c;
          }
          write &operator <<(long long x) {
              static unsigned stk[30], tp;
      
              do
                  stk[tp++] = '0' + x % 10, x /= 10;
      
              while (x);
      
              while (tp)
                  pc(stk[--tp]);
      
              return *this;
          }
          write &operator <<(char c) {
              return pc(c), *this;
          }
      } cout;
      unsigned n, s[500010][2], fail[500010];
      unsigned val[500010], a[500010], p[500010];
      namespace TT {
      unsigned rt, cnt, sz[1000010], csz[1000010], A[1000010], B[1000010], ls[500010], rs[500010], tp[500010];
      unsigned s[500010], fa[500010], son[500010];
      unsigned newnode(unsigned x) {
          unsigned u = x + n;
          csz[u] = sz[u] = 1, A[u] = B[u] = x;
          return u;
      }
      unsigned bd(unsigned x, unsigned y, unsigned p) {
          unsigned u = ++cnt;
          ls[u] = x, rs[u] = y, sz[u] = sz[x] + sz[y], tp[u] = p;
      
          if (p == 0)
              csz[u] = csz[x] + csz[y], A[u] = A[x], B[u] = B[y];
          else
              csz[u] = csz[x], A[u] = A[x], B[u] = B[x];
      
          return u;
      }
      unsigned c[500010], cs[500010], ccnt;
      unsigned cbuild(unsigned l, unsigned r, unsigned p) {
          if (l == r)
              return c[l];
      
          unsigned u = std::lower_bound(cs + l, cs + r, cs[l - 1] + (cs[r] - cs[l - 1]) / 2) - cs;
      
          if (u == r)
        
      

      1周前 来自 浙江

      0

热门讨论