제출 #693055

#제출 시각아이디문제언어결과실행 시간메모리
693055zeroesandonesSolar Storm (NOI20_solarstorm)C++17
10 / 100
2093 ms13680 KiB
#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]; pi ans = {0, 0}; FOR(i, 0, n) { // shield is placed at i ll dist = 0; ll left = i; FORD(j, i - 1, 0) { if(d[j] + dist > k) break; left = j; dist += d[j]; } ll right = i; dist = 0; FOR(j, i + 1, n) { if(d[j - 1] + dist > k) break; right = j; dist += d[j - 1]; } ll curr = 0; FOR(j, left, right + 1) { curr += a[j]; } if(curr > ans.fr) { ans = {curr, i}; } } cout << 1 << nl; cout << ans.sc + 1 << nl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t = 1; // cin >> t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...