fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long int n,m,a1,b1,c1,d,k,op,i;
  6. cin>>n>>m;
  7. long long int a[n+10],b[n+10];
  8. for(i=1;i<=n;i++)
  9. cin>>a[i];
  10. for(i=1;i<=n;i++)
  11. cin>>b[i];
  12. // memset(c,1,sizeof(c));
  13. while(m--)
  14. { long long int s=0,min=0,l,r;
  15. cin>>op;
  16. if(op==3)
  17. {
  18. cin>>a1>>b1>>c1>>d;
  19. while(c1<=d&&a1<=b1)
  20. {
  21. s+=a[c1]*c[a1];
  22. c1++; a1++;
  23. }
  24. cout<<s<<endl;
  25. }
  26. /* else if(op==2)
  27.   { cin>>k; long long int y=n;
  28.   if(min<k)
  29.   {
  30.   min=k;
  31.   while(i<k)
  32.   {
  33.   a[y]=-1; y--; i++;
  34.   }
  35.   }
  36.   }
  37.   else
  38.   { long long int p,q,z;
  39.   cin>>l>>r; z=l;
  40.   for(i=r;i>=l;i++)
  41.   {
  42.   a[z]=p; b[z]=q;
  43.   a[i]=q; b[i]=p; z++;
  44.   }
  45.   }*/
  46. }
  47. return 0;
  48. }
Compilation error #stdin compilation error #stdout 0s 4368KB
stdin
7 9
3 5 0 2 5 7 4
2 8 4 4 0 1 6
3 1 3 3 5
2 1
1 2 6
1 2 7
2 3
3 1 5 3 7
3 1 7 1 7
1 1 6
3 1 7 1 7
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:21:25: error: ‘c’ was not declared in this scope
                s+=a[c1]*c[a1];
                         ^
stdout
Standard output is empty