#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;
#define fur(i, a, b) for(ll i = a; i <= (ll) b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll) b; --i)
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define nl "\n"
const ll mxn = 1e4L + 1;
#warning mxn is according to subtask
ll n, s, k;
ll d[mxn];
ll v[mxn];
ll x[mxn];
bool has[mxn] = {};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> s >> k;
fur(i, 1, n - 1) {
cin >> d[i];
}
fur(i, 1, n) {
cin >> v[i];
}
x[1] = 0;
fur(i, 2, n) {
x[i] = x[i - 1] + d[i - 1];
}
ll res = 0;
vl ans;
vl tmp;
fur(i, 1, n) {
tmp.clear();
ll lt = i;
ll cur = i;
tmp.pb(cur);
fur(j, 2, s) {
ll nex = upper_bound(x + cur, x + n + 1, x[cur] + k) - x;
nex = upper_bound(x + nex, x + n + 1, x[nex] + k) - x - 1;
cur = nex;
tmp.pb(nex);
}
ll rt = cur;
ll opt = 0;
fur(j, 1, n) {
if(j < lt) {
if(x[j] + k >= x[lt])
opt += v[j];
} else if(j > rt) {
if(x[rt] + k >= x[j])
opt += v[j];
} else {
opt += v[j];
}
}
if(res < opt) {
res = opt;
swap(tmp, ans);
}
}
cout << ans.size() << nl;
for(auto u : ans)
cout << u << ' ';
cout << nl;
}
Compilation message
SolarStorm.cpp:3:5: error: extended character is not valid in an identifier
3 |
| ^
SolarStorm.cpp:11:5: error: extended character is not valid in an identifier
11 |
| ^
SolarStorm.cpp:22:5: error: extended character is not valid in an identifier
22 |
| ^
SolarStorm.cpp:24:6: warning: #warning mxn is according to subtask [-Wcpp]
24 | #warning mxn is according to subtask
| ^~~~~~~
SolarStorm.cpp:30:5: error: extended character is not valid in an identifier
30 |
| ^
SolarStorm.cpp:34:5: error: extended character is not valid in an identifier
34 |
| ^
SolarStorm.cpp:36:5: error: extended character is not valid in an identifier
36 |
| ^
SolarStorm.cpp:40:5: error: extended character is not valid in an identifier
40 |
| ^
SolarStorm.cpp:44:5: error: extended character is not valid in an identifier
44 |
| ^
SolarStorm.cpp:49:5: error: extended character is not valid in an identifier
49 |
| ^
SolarStorm.cpp:65:5: error: extended character is not valid in an identifier
65 |
| ^
SolarStorm.cpp:78:5: error: extended character is not valid in an identifier
78 |
| ^
SolarStorm.cpp:84:5: error: extended character is not valid in an identifier
84 |
| ^
SolarStorm.cpp:3:5: error: '\U000000a0' does not name a type
3 |
| ^
SolarStorm.cpp:6:21: error: 'll' was not declared in this scope; did you mean 'nl'?
6 | using pl = pair<ll, ll>;
| ^~
| nl
SolarStorm.cpp:6:25: error: 'll' was not declared in this scope; did you mean 'nl'?
6 | using pl = pair<ll, ll>;
| ^~
| nl
SolarStorm.cpp:6:27: error: template argument 1 is invalid
6 | using pl = pair<ll, ll>;
| ^
SolarStorm.cpp:6:27: error: template argument 2 is invalid
SolarStorm.cpp:8:23: error: 'll' was not declared in this scope; did you mean 'nl'?
8 | using vl = vector<ll>;
| ^~
| nl
SolarStorm.cpp:8:25: error: template argument 1 is invalid
8 | using vl = vector<ll>;
| ^
SolarStorm.cpp:8:25: error: template argument 2 is invalid
SolarStorm.cpp:10:24: error: 'pl' was not declared in this scope; did you mean 'pi'?
10 | using vpl = vector<pl>;
| ^~
| pi
SolarStorm.cpp:10:26: error: template argument 1 is invalid
10 | using vpl = vector<pl>;
| ^
SolarStorm.cpp:10:26: error: template argument 2 is invalid
SolarStorm.cpp:11:5: error: '\U000000a0' does not name a type
11 |
| ^
SolarStorm.cpp:25:5: error: 'll' does not name a type; did you mean 'nl'?
25 | ll n, s, k;
| ^~
| nl
SolarStorm.cpp:26:5: error: 'll' does not name a type; did you mean 'nl'?
26 | ll d[mxn];
| ^~
| nl
SolarStorm.cpp:27:5: error: 'll' does not name a type; did you mean 'nl'?
27 | ll v[mxn];
| ^~
| nl
SolarStorm.cpp:28:5: error: 'll' does not name a type; did you mean 'nl'?
28 | ll x[mxn];
| ^~
| nl
SolarStorm.cpp:29:14: error: 'mxn' was not declared in this scope
29 | bool has[mxn] = {};
| ^~~
SolarStorm.cpp:30:5: error: '\U000000a0' does not name a type
30 |
| ^