QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#95867#4389. Copy3360550356Compile Error//C++141.0kb2023-04-12 10:04:332023-04-12 10:04:35

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-12 10:04:35]
  • 评测
  • [2023-04-12 10:04:33]
  • 提交

answer

const int N=100010;  
bitset<N>ans;  
int a[N];  
struct que{  
    int oper,l,r;  
};  
que q[N];  
void solve(){  
    int k;  
    scanf("%d %d",&n,&k);     //左移或右移  
    ans.reset();  
    for(int i=1;i<=n;i++){  
        scanf("%d",&a[i]);  
    }  
    bitset<N>now;  
    for(int i=1;i<=k;i++){  
        scanf("%d",&q[i].oper);  
        if(q[i].oper==1){  
            scanf("%d %d",&q[i].l,&q[i].r);  
        }  
        if(q[i].oper==2){  
            scanf("%d",&q[i].l);  
        }  
    }  
    for(int i=k;i>=1;i--){  
        int oper=q[i].oper;  
        int l=q[i].l;  
        int r=q[i].r;  
        if(oper==2){  
            ans[l]=1-ans[l];  
        }  
        else {  
            auto a = ans & (~bitset<N>(0) >> (N - r - 1));  
            auto b = ans & (~bitset<N>(0) << (r + 1));  
            ans = a ^ (b >> (r + 1 - l));  
        }  
    }  
    long long res=0;  
    for(int i=1;i<=n;i++){  
        if(ans[i])  res^=a[i];  
    }  
    printf("%lld\n",res);  
    return ;  
}

詳細信息

answer.code:2:1: error: ‘bitset’ does not name a type
    2 | bitset<N>ans;
      | ^~~~~~
answer.code: In function ‘void solve()’:
answer.code:10:20: error: ‘n’ was not declared in this scope
   10 |     scanf("%d %d",&n,&k);     //左移或右移
      |                    ^
answer.code:10:5: error: ‘scanf’ was not declared in this scope
   10 |     scanf("%d %d",&n,&k);     //左移或右移
      |     ^~~~~
answer.code:11:5: error: ‘ans’ was not declared in this scope
   11 |     ans.reset();
      |     ^~~
answer.code:15:5: error: ‘bitset’ was not declared in this scope
   15 |     bitset<N>now;
      |     ^~~~~~
answer.code:15:14: error: ‘now’ was not declared in this scope
   15 |     bitset<N>now;
      |              ^~~
answer.code:42:5: error: ‘printf’ was not declared in this scope
   42 |     printf("%lld\n",res);
      |     ^~~~~~
answer.code:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | const int N=100010;