Submission #767284

# Submission time Handle Problem Language Result Execution time Memory
767284 2023-06-26T15:05:12 Z ivopav Addk (eJOI21_addk) C++17
0 / 100
103 ms 2988 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int k;
    cin >> n >> k;
    vector<int> lis={};
    for (int i=0;i<n;i++){
        int unos;
        cin >> unos;
        lis.push_back(unos);
    }
    vector<int> pref={0};
    for (int i=0;i<n;i++){
        pref.push_back(pref.back()+lis[i]);
    }
    vector<int> prefpref={0 };
    //cout << "0 ";
    for (int i=0;i<pref.size();i++){
        prefpref.push_back(prefpref.back()+pref[i]);
        //cout << prefpref.back() << " ";
    }
   // cout << "\n";
    int m;
    cin >> m;
    for (int i=0;i<m;i++){
        int vrs;
        int l;
        int r;
        int m;
        cin >> vrs >> l >> r >> m;
        m=min(m,(r-l+2)/2);
        cout << (prefpref[r+1]-prefpref[r-m+1])-(prefpref[l+m-1]-prefpref[l-1]) << "\n";
    }

}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:20:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i=0;i<pref.size();i++){
      |                  ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 1424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 2988 KB Output isn't correct
2 Halted 0 ms 0 KB -