답안 #693050

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
693050 2023-02-02T10:05:15 Z saayan007 Solar Storm (NOI20_solarstorm) C++17
0 / 100
114 ms 27032 KB
#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"

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n, s, k;
    cin >> n >> s >> k;
    ll d[n];
    fur(i, 1, n - 1) {
        cin >> d[i];
    }

    ll v[n + 1];
    fur(i, 1, n) {
        cin >> v[i];
    }

    ll x[n + 1];
    x[1] = 0;
    fur(i, 2, n) {
        x[i] = x[i - 1] + d[i - 1];
    }
    // fur(i, 1, n) {
        // cout << x[i] << ' ';
    // }
    // cout << nl;
    // fur(i, 1, n) {
        // cout << v[i] << ' ';
    // }
    // cout << nl;

    ll res = 0;
    ll best = 0;
    ll sum[n + 1];
    sum[0] = 0;
    fur(i, 1, n) {
        sum[i] = v[i] + sum[i - 1];
    }
    fur(i, 1, n) {
        ll lt = sum[i] - sum[max(0ll, i - k)];
        ll rt = sum[min(n, i + k)] - sum[min(n, i + 1)];
        if(lt + rt > res) {
            res = lt + rt;
            best = i;
        }
    }
    cout << 1 << nl << best << nl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 3 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 109 ms 27032 KB Output is correct
2 Correct 76 ms 22088 KB Output is correct
3 Incorrect 84 ms 23676 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 3 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 114 ms 25176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 3 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 3 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 3 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -