Submission #632002

#TimeUsernameProblemLanguageResultExecution timeMemory
632002Jovan26Addk (eJOI21_addk)C++14
0 / 100
242 ms868 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int k; cin>>k; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; int q; cin>>q; bool p = false; vector<long long> v; for(int j=0;j<q;j++){ int x; cin>>x; if(x==1){ int y; cin>>y; continue; } int l,r,m; p = true; cin>>l>>r>>m; int ma = min(m,(r-l+1-m+1)); long long rez = 0; for(int i=l-1;i<l+ma-2;i++){ rez+=(i-l+2)*a[i]; } for(int i=r-1;i>=r-ma;i--){ rez+=(r-i)*a[i]; } for(int i=l+ma-2;i<r-ma;i++){ rez+=a[i]*ma; } v.push_back(rez); } if(p){ for(int i=0;i<v.size()-1;i++) cout<<v[i]<<endl; cout<<v[v.size()-1]; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:39:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for(int i=0;i<v.size()-1;i++) cout<<v[i]<<endl;
      |              ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...