QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#504638#9105. Zayin and CampLavender_Field#Compile Error//C++11982b2024-08-04 14:23:442024-08-04 14:23:45

Judging History

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

  • [2024-08-04 14:23:45]
  • 评测
  • [2024-08-04 14:23:44]
  • 提交

answer

CERWER#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+5;
int n,m;
int b[N*65],cnt;
unordered_map<int,int> ma;
#define lowbit(x) ((x)&(-x))
signed main(){
    scanf("%lld%lld",&n,&m);
    for(int i=1,opt;i<=m;i++){
        scanf("%lld",&opt);
        if(opt==1){
            int x,v;
            scanf("%lld%lld",&x,&v);
            int oriv=v;
            while(x<=n){
                if(!ma.contains(x)) ma[x]=v;
                else ma[x]+=v;
                v+=oriv;
                x+=lowbit(x);
            }
        }
        else{
            int l,r,ans;
            scanf("%lld%lld",&l,&r);
            while(r){
                if(ma.contains(r)) ans+=ma[r];
                r-=lowbit(r);
            }
            l--;
            while(l){
                if(ma.contains(l)) ans-=ma[l];
                l-=lowbit(l);
            }
            printf("%lld\n",ans);
        }
    }
    return 0;
}

詳細信息

answer.code:1:7: error: stray ‘#’ in program
    1 | CERWER#include<bits/stdc++.h>
      |       ^
answer.code:1:1: error: ‘CERWER’ does not name a type
    1 | CERWER#include<bits/stdc++.h>
      | ^~~~~~
answer.code:7:1: error: ‘unordered_map’ does not name a type
    7 | unordered_map<int,int> ma;
      | ^~~~~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:10:5: error: ‘scanf’ was not declared in this scope
   10 |     scanf("%lld%lld",&n,&m);
      |     ^~~~~
answer.code:18:21: error: ‘ma’ was not declared in this scope; did you mean ‘m’?
   18 |                 if(!ma.contains(x)) ma[x]=v;
      |                     ^~
      |                     m
answer.code:28:20: error: ‘ma’ was not declared in this scope; did you mean ‘m’?
   28 |                 if(ma.contains(r)) ans+=ma[r];
      |                    ^~
      |                    m
answer.code:33:20: error: ‘ma’ was not declared in this scope; did you mean ‘m’?
   33 |                 if(ma.contains(l)) ans-=ma[l];
      |                    ^~
      |                    m
answer.code:36:13: error: ‘printf’ was not declared in this scope
   36 |             printf("%lld\n",ans);
      |             ^~~~~~
answer.code:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | CERWER#include<bits/stdc++.h>