This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define sp " "
#define all(x) (x).begin(), (x).end()
#define sc second
#define fr first
#define pb emplace_back
void solve()
{
ll n, s, k;
cin >> n >> s >> k;
ll d[n - 1];
FOR(i, 0, n - 1)
cin >> d[i];
ll a[n];
FOR(i, 0, n)
cin >> a[i];
ll psum[n] = {};
psum[0] = a[0];
FOR(i, 1, n)
psum[i] = psum[i - 1] + a[i];
pi ans = {0, 0};
for(int i = 0; i < n; ++i) {
// modules [i - s, i] will be protected
ll right = i + s - 1;
if(right >= n) break;
ll curr = psum[right] - (i == 0 ? 0 : psum[i - 1]);
if(curr > ans.fr) {
ans = {curr, i};
}
}
vi pro;
for(int i = 0; i < s; ++i) {
pro.pb(ans.sc + i + 1);
}
cout << pro.size() << nl;
for(auto i : pro)
cout << i << sp;
cout << nl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t = 1;
// cin >> t;
while (t--)
{
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |