QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#95868#4389. Copy3360550356Compile Error//C++141.1kb2023-04-12 10:05:442023-04-12 10:05:48

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:05:48]
  • 评测
  • [2023-04-12 10:05:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std; 
const int N=100010;  
bitset<N>ans;  
int a[N];  
struct que{  
    int oper,l,r;  
};  
que q[N];  
int 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: In function ‘void solve()’:
answer.code:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d %d",&n,&k);     //左移或右移
      |     ~~~~~^~~~~~~~~~~~~~~
answer.code:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
answer.code:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         scanf("%d",&q[i].oper);
      |         ~~~~~^~~~~~~~~~~~~~~~~
answer.code:22:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |             scanf("%d %d",&q[i].l,&q[i].r);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:25:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |             scanf("%d",&q[i].l);
      |             ~~~~~^~~~~~~~~~~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status