Submission #63597440


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
using ui = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,l,r) for(int i=(l);i>=(r);--i)
#define repn(i,n) for(int i=0;i<(n);++i)
#define sizc(x) ((int)(x).size())
#define allc(x) (x).begin(),(x).end()
#define fir first
#define sec second
constexpr int N = 2e5+5;
int n;
ll a[N];
ll f[N];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;

using ui = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,l,r) for(int i=(l);i>=(r);--i)
#define repn(i,n) for(int i=0;i<(n);++i)
#define sizc(x) ((int)(x).size())
#define allc(x) (x).begin(),(x).end()
#define fir first
#define sec second

constexpr int N = 2e5+5;

int n;
ll a[N];
ll f[N];

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

    cin>>n;
    rep(i,1,n)cin>>a[i];
    f[1]=a[1];
    rep(i,2,n)f[i]=max(f[i-1]+a[i],f[i-2]);
    cout<<f[n]<<'\n';
}

Submission Info

Submission Time
Task A - Operations on a Stack
User KnownError_
Language C++ 20 (gcc 12.2)
Score 400
Code Size 653 Byte
Status AC
Exec Time 15 ms
Memory 6724 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 28
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 1 ms 3416 KB
001.txt AC 1 ms 3412 KB
002.txt AC 12 ms 6508 KB
003.txt AC 14 ms 6588 KB
004.txt AC 13 ms 6580 KB
005.txt AC 13 ms 6724 KB
006.txt AC 13 ms 6580 KB
007.txt AC 1 ms 3472 KB
008.txt AC 1 ms 3392 KB
009.txt AC 1 ms 3528 KB
010.txt AC 8 ms 5064 KB
011.txt AC 3 ms 3988 KB
012.txt AC 7 ms 4796 KB
013.txt AC 8 ms 5172 KB
014.txt AC 9 ms 5472 KB
015.txt AC 14 ms 6588 KB
016.txt AC 14 ms 6592 KB
017.txt AC 14 ms 6508 KB
018.txt AC 15 ms 6544 KB
019.txt AC 14 ms 6640 KB
020.txt AC 14 ms 6516 KB
021.txt AC 14 ms 6724 KB
022.txt AC 14 ms 6584 KB
023.txt AC 14 ms 6544 KB
024.txt AC 14 ms 6572 KB
example0.txt AC 1 ms 3444 KB
example1.txt AC 1 ms 3520 KB
example2.txt AC 1 ms 3408 KB


2025-03-18 (Tue)
08:11:53 +00:00