245312026-02-12 17:25:48GergoszaboVásárlás (75 pont)cpp17Wrong answer 21/7563ms3652 KiB
#include <iostream>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

const ll INF = 1e18;

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<ll> prefa(n+1, 0);
    vector<ll> prefb(n+1, 0);
    for (int i = 0; i < n; i++){
        cin >> a[i];
        prefa[i+1] = a[i] + prefa[i];
    }
    for (int i = 0; i < n; i++){
        cin >> b[i];
        prefb[i+1] = b[i] + prefb[i];
    }
    ll ans = 0;
    ll minans = INF;
    for (int i = 0; i <= n; i++){
        ans = min(prefa[i] + prefb[n] - prefb[i], prefb[i] + prefa[n] - prefa[i]);
        if (ans < minans) minans = ans;
    }
    cout << minans;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base21/75
1Accepted0/01ms316 KiB
2Wrong answer0/030ms1956 KiB
3Accepted3/31ms500 KiB
4Wrong answer0/41ms316 KiB
5Wrong answer0/41ms316 KiB
6Accepted4/41ms316 KiB
7Wrong answer0/41ms316 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/43ms316 KiB
10Wrong answer0/42ms456 KiB
11Wrong answer0/42ms316 KiB
12Accepted5/52ms316 KiB
13Wrong answer0/359ms3512 KiB
14Wrong answer0/359ms3648 KiB
15Wrong answer0/361ms3520 KiB
16Wrong answer0/359ms3636 KiB
17Wrong answer0/361ms3636 KiB
18Wrong answer0/363ms3644 KiB
19Accepted3/357ms3652 KiB
20Accepted3/359ms3644 KiB
21Wrong answer0/361ms3648 KiB
22Wrong answer0/341ms3124 KiB
23Wrong answer0/363ms3640 KiB
24Accepted3/357ms3636 KiB