답안 #1071902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071902 2024-08-23T12:13:49 Z edogawa_something Tricks of the Trade (CEOI23_trade) C++17
5 / 100
49 ms 26560 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
const ll M=5e5+10;
const ll inf=2e18;
ll n,k,a[M],b[M],pre[M],suf[M],pm[M],sm[M];
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        cin>>b[i];
    pre[0]=b[0];
    for(int i=1;i<n;i++) {
        pre[i]=pre[i-1]-b[i-1]+a[i-1]+b[i];
    }
    suf[0]=b[0]-a[0];
    for(int i=1;i<n;i++) {
        suf[i]=suf[i-1]-b[i-1]-a[i]+b[i];
    }
    pm[0]=pre[0];
    for(int i=1;i<n;i++)
        pm[i]=max(pre[i],pm[i-1]);
    sm[n-1]=suf[n-1];
    for(int i=n-2;i>=0;i--)
        sm[i]=max(suf[i],sm[i+1]);
    ll ans=-inf;
    for(int i=0;i<n-1;i++) {
        ans=max(ans,pre[i]+sm[i+1]);
    }
    cout<<ans<<'\n';
    for(int i=0;i<n;i++) {
        cout<<0;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 10588 KB Partially correct
2 Partially correct 40 ms 24176 KB Partially correct
3 Partially correct 38 ms 26452 KB Partially correct
4 Partially correct 41 ms 26544 KB Partially correct
5 Partially correct 43 ms 26312 KB Partially correct
6 Partially correct 49 ms 25912 KB Partially correct
7 Partially correct 36 ms 25532 KB Partially correct
8 Partially correct 38 ms 26292 KB Partially correct
9 Partially correct 30 ms 24908 KB Partially correct
10 Partially correct 33 ms 25432 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 10588 KB Partially correct
2 Partially correct 40 ms 24176 KB Partially correct
3 Partially correct 38 ms 26452 KB Partially correct
4 Partially correct 41 ms 26544 KB Partially correct
5 Partially correct 43 ms 26312 KB Partially correct
6 Partially correct 49 ms 25912 KB Partially correct
7 Partially correct 36 ms 25532 KB Partially correct
8 Partially correct 38 ms 26292 KB Partially correct
9 Partially correct 30 ms 24908 KB Partially correct
10 Partially correct 33 ms 25432 KB Partially correct
11 Partially correct 1 ms 10592 KB Partially correct
12 Partially correct 48 ms 24388 KB Partially correct
13 Partially correct 37 ms 26460 KB Partially correct
14 Partially correct 38 ms 26560 KB Partially correct
15 Partially correct 36 ms 26216 KB Partially correct
16 Partially correct 37 ms 25936 KB Partially correct
17 Partially correct 34 ms 25432 KB Partially correct
18 Partially correct 37 ms 26452 KB Partially correct
19 Partially correct 30 ms 24916 KB Partially correct
20 Partially correct 34 ms 25552 KB Partially correct
21 Incorrect 1 ms 10588 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -