Submission #1020306

#TimeUsernameProblemLanguageResultExecution timeMemory
1020306vjudge1Addk (eJOI21_addk)C++17
36 / 100
2053 ms3528 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; vector<int> vec; for(;n>0;n--) { int x; cin>>x; vec.push_back(x); } int q; cin>>q; for(;q>0;q--) { int x; cin>>x; if(x==1) { for(int k1=k;k1>0;k1--) { int a; cin>>a; } } else { int l,r,m; cin>>l>>r>>m; l--; r--; long long p1=l,p2=l,sum=0,res=0; for(;p2<m+l;p2++) { sum=sum+vec[p2]; } p2--; for(;p2<=r;p2++,p1++) { res=res+sum; sum=sum-vec[p1]; if(p2!=vec.size()-1) sum=sum+vec[p2+1]; } cout<<res<<endl; } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:46:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |                 if(p2!=vec.size()-1)
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...