• hdu 6186 水


    hdu 6186   CS Course

    求个前后缀就好了

    #include<bits/stdc++.h>
    using namespace std;
    #pragma comment(linker, "/STACK:102400000,102400000")
    #define rep(i,a,b) for (int i=a; i<=b; ++i)
    #define per(i,b,a) for (int i=b; i>=a; --i)
    #define mes(a,b)  memset(a,b,sizeof(a))
    #define INF 0x3f3f3f3f
    #define MP make_pair
    #define PB push_back
    #define fi  first
    #define se  second
    typedef long long ll;
    const int N = 100005;
    
    int n, q, a[N], pi, s11[N], s12[N], s21[N], s22[N], s31[N], s32[N];
    int main()
    {
        while(~scanf("%d%d", &n, &q))
        {
            s11[0]=s12[n+1]=(1<<31)-1;
            s21[0]=s22[n+1]=0;
            s31[0]=s32[n+1]=0;
            rep(i,1,n)
            {
                scanf("%d", &a[i]);
                s11[i] = s11[i-1]&a[i];
                s21[i] = s21[i-1]|a[i];
                s31[i] = s31[i-1]^a[i];
            }
            per(i,n,1)
            {
                s12[i] = s12[i+1]&a[i];
                s22[i] = s22[i+1]|a[i];
                s32[i] = s32[i+1]^a[i];
            }
            rep(i,1,q)
            {
                scanf("%d", &pi);
                printf("%d %d %d
    ", s11[pi-1]&s12[pi+1], s21[pi-1]|s22[pi+1], s31[pi-1]^s32[pi+1]);
            }
        }
    
        return 0;
    }
  • 相关阅读:
    人月神话2
    cJson 常见用法
    Python C扩展
    动态链接--运行时加载dlopen
    mtrace 简介
    Linux coredump
    动态链接--so的搜索过程
    线程同步--条件变量
    编译过程学习
    Linux 信号
  • 原文地址:https://www.cnblogs.com/sbfhy/p/7462236.html
Copyright © 2020-2023  润新知