2015年12月

BZOJ 1012 zkw

嗯嗯向我这种没智商的沙茶一定是会打残代码的。
同一个名称就不要乱用了啊(die。
或许说太久没打zkw忘了怎么打还是得翻以前的代码……
一言以蔽之,曰智商低。

#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 2e5;
namespace FastIO
{
    template<class T>
    void read(T& x)
    {
        char ch = getchar(); T n = 1, a = 0;
        while(ch < '0' || ch > '9'){if(ch == '-') n = -1; ch = getchar();}
        while(ch >= '0' && ch <= '9'){a = a * 10 + ch - '0'; ch = getchar();}
        x = n * a;
    }
    template<class T, class U>
    void read(T& x, U& y)
    {
        read(x), read(y);
    }
}
using namespace FastIO;

struct info
{
    int ma;
    info(int x = 0) : ma(x){}
} A[maxn * 3];

int main()
{
    int m, d;
    read(m, d);
    int t = 0, cur = 0;
    int zkwt = 1;
    while(zkwt <= maxn + 3) zkwt <<= 1;
    while(m--)
    {
        char a[2];int n;
        scanf("%s", a);
        read(n);
        if(a[0] == 'A')
        {
            int i;
            for(A[i = cur + zkwt + 1] = info((n + t) % d), i >>= 1; i > 0; i >>= 1)
                A[i].ma = max(A[i * 2].ma, A[i * 2 + 1].ma); 
            cur++;
        }
        else
        {
            int ans = 0;
            for(int l = cur - n + zkwt, r = cur + zkwt + 1; l ^ r ^ 1; l >>= 1, r >>= 1)
            {
                if(~l & 1)
                    ans = max(ans, A[l ^ 1].ma);
                if(r & 1)
                    ans = max(ans, A[r ^ 1].ma);
            }
            printf("%d\n", t = ans);
        }
    }
    return 0;
}
bst g22 jinniu lilai opebet orange88 vinbet xbet yuebo zunlong shijiebei bet007 hg0088 ju111 letiantang m88 mayaba qg777 qianyiguoji sbf777 tengbohui tlc ule weilianxier waiweitouzhu xingfayule xinhaotiandi yinheyule youfayule zhongying 2018shijiebei w88 18luck 188bet beplay manbet 12bet 95zz shenbo weide1946 ca88 88bifa aomenxinpujing betway bodog bt365 bwin tongbao vwin weinisiren 88jt fenghuangyule hongyunguoji 918botiantang huanyayule jianada28 jixiangfang libo long8 hongzuyishi zuqiutouzhu