Submission #469670

#TimeUsernameProblemLanguageResultExecution timeMemory
469670MohamedFaresNebiliHoliday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include"holiday.h"

using namespace std;

using ll  = long long;
using ld  = long double;

#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin() , (x).end()

const ll MOD = 998244353;
const long double EPS = 0.000000001;
const double PI = 3.14159265358979323846;
const int nx[8] = { 2, 1, -1, -2, -2, -1, 1, 2 };
const int ny[8] = { 1, 2, 2, 1, -1, -2, -2, -1 };

bool vis[100005]; ll dp[]
long long int solve(int i, int d, int n, int arr[]) {
    if(d==0) return 0;
    long long best;
    if(i==0) {
        if(vis[i]) best=solve(i+1, d-1, n, arr);
        else {
            ll a=solve(i+1, d-1, n, arr);
            vis[i]=1; ll b=arr[i]+solve(i, d-1, n, arr); vis[i]=0;
            best=max(a, b);
        }
        return best;
    }
    if(i==n-1) {
        if(vis[i]) best=solve(i-1, d-1, n, arr);
        else {
            ll a=solve(i-1, d-1, n, arr);
            vis[i]=1; ll b=arr[i]+solve(i, d-1, n, arr); vis[i]=0;
            best=max(a, b);
        }
        return best;
    }
    if(vis[i]) best=max(solve(i-1, d-1, n, arr), solve(i+1, d-1, n, arr));
    else {
        ll a=max(solve(i+1, d-1, n, arr), solve(i-1, d-1, n, arr));
        vis[i]=1; ll b=arr[i]+solve(i, d-1, n, arr); vis[i]=0;
        best=max(a, b);
    }
    return best;
}
long long int findMaxAttraction(int n, int start, int d, int arr[]) {
    memset(vis, false, sizeof vis);
    return solve(start, d, n, arr);
}

Compilation message (stderr)

holiday.cpp:24:1: error: expected initializer before 'long'
   24 | long long int solve(int i, int d, int n, int arr[]) {
      | ^~~~
holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:55:12: error: 'solve' was not declared in this scope
   55 |     return solve(start, d, n, arr);
      |            ^~~~~