/ SeriousOJ /

Record Detail

Compile Error

foo.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.

Code

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 10;
const int p = 1e6 + 7;
int a[N] , b[N] , c[N] , dp1[N] , dp2[N] , dp3[N];
signed main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    int T; cin>>T;
    while (T--)
    {
        int n;cin >> n;
        for(int i = 1;i <= n;i++) cin >> a[i];
        for(int i = 1;i <= n;i++) cin >> b[i];
        for(int i = 1;i <= n;i++) cin >> c[i];
        for(int i = 1;i <= n;i++)
        {
            dp1[i] = max(dp2[i - 1] , dp3[i - 1]) + a[i];
            dp2[i] = max(dp1[i - 1] , dp3[i - 1]) + b[i];
            dp3[i] = max(dp1[i - 1] , dp2[i - 1]) + c[i];
        }
        cout << max(max(dp1[n] , dp2[n]) , dp3[n])<<endl;
    }
    
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1046 Maximum sum in 3-array
Contest
TLE_Headquarters - round #1
Language
C99 (GCC 13.2.0)
Submit At
2024-03-27 17:03:19
Judged At
2024-10-03 13:56:09
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes