Submission #7067617


Source Code Expand

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define endl '\n'
#define _ << ' '
#define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x)))
#define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)3e9+1;

int n;
int dp[2][100], a[2][100];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("D.txt", "r", stdin);
    #endif
    cin >> n;
    for(int i=0; i<2; i++)
    {
        for(int j=0; j<n; j++)
        {
            cin >> a[i][j];
        }
    }
    dp[0][0] = a[0][0];
    dp[1][0] = a[1][0] + a[0][0];
    for(int i=1; i<n; i++)
    {
        dp[0][i] = dp[0][i-1] + a[0][i];
        dp[1][i] = max(dp[0][i-1], dp[1][i-1]) + a[1][i];
    }
    cout << dp[1][n-1];
}

Submission Info

Submission Time
Task C - Candies
User animefan6588
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1395 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
WA × 2
AC × 6
WA × 10
Set Name Test Cases
Sample sample01.txt, sample02.txt, sample03.txt, sample04.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample01.txt, sample02.txt, sample03.txt, sample04.txt
Case Name Status Exec Time Memory
01.txt WA 1 ms 256 KB
02.txt AC 1 ms 256 KB
03.txt WA 1 ms 256 KB
04.txt WA 1 ms 256 KB
05.txt WA 1 ms 256 KB
06.txt WA 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
09.txt WA 1 ms 256 KB
10.txt WA 1 ms 256 KB
11.txt WA 1 ms 256 KB
12.txt AC 1 ms 256 KB
sample01.txt WA 1 ms 256 KB
sample02.txt AC 1 ms 256 KB
sample03.txt WA 1 ms 256 KB
sample04.txt AC 1 ms 256 KB