Submission #856277

# Submission time Handle Problem Language Result Execution time Memory
856277 2023-10-03T03:34:27 Z onepunchac168 Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
//------------------------------------\\
//   ------------------------------   \\
//  |  created by Dinh Manh Hung   |  \\
//  |      tht.onepunchac168       |  \\
//  |     THPT CHUYEN HA TINH      |  \\
//  |      HA TINH, VIET NAM       |  \\
//  |           Siuuu              |  \\
//   ------------------------------   \\
//------------------------------------\\

#include <bits/stdc++.h>
#include "dungeons.h"
using namespace std;


// DEBUG
/*
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
*/

/* END OF TEMPLATE*/

// ================= Solution =================//

/*
void onepunchac168();

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    file(task);
    int tests;
    tests=1;
    //cin>>tests;
    while (tests--)
    {
        onepunchac168();
    }
}

const int N=2e5+5;

void onepunchac168()
{

}
*/

const int L1=6;
const int L2=24;
const int N=4e5+1;
int dp[L1][L2][N];
long long take[L1][L2][N];
int nxt[L1][L2][N];
int BS[L1];
int MAX=1e9+5;
int solve;
vector <int > S,P,W,L;

void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l)
{
    solve=n;
    n++;
    solve++;
    BS[0]=1;
    S=s;
    P=p;
    W=w;
    L=l;
    for (int i=1;i<L1;i++)
    {
        BS[i]=BS[i-1]*32;
    }
    for (int i=0;i<L1;i++)
    {
        for (int j=1;j<n;j++)
        {
            if (BS[i]>s[j-1])
            {
                dp[i][0][j]=MAX+10;
                nxt[i][0][j]=w[j-1]+1;
                take[i][0][j]=s[j-1];
            }
            else
            {
                dp[i][0][j]=s[j-1];
                nxt[i][0][j]=l[j-1]+1;
                take[i][0][j]=p[j-1];
            }
        }
    }

    for (int i=0;i<L1;i++)
    {
        for (int j=0;j<L2;j++)
        {
            nxt[i][j][n]=n;
        }
        for (int j=1;j<L2;j++)
        {
            for (int h=1;h<n;h++)
            {
                int gg=nxt[i][j-1][h];
                nxt[i][j][h]=nxt[i][j-1][gg];
                take[i][j][h]=take[i][j-1][h]+take[i][j-1][gg];
                if (dp[i][j-1][gg]==MAX+10)
                {
                    dp[i][j][h]=dp[i][j-1][h];
                    continue;
                }
                if (take[i][j-1][h]>=dp[i][j-1][gg])
                {
                    dp[i][j][h]=0;
                    continue;
                }
                dp[i][j][h]=min(dp[i][j-1][h],dp[i][j-1][gg]-int(take[i][j-1][h]));
            }
        }
    }
    return;
}

long long simulate(int x, int z)
{
    x++;
    long long orz=z;
    int tmp=0;
    while (true)
    {
        if (x==solve)
        {
            break;
        }
        while (tmp+1<L1&&BS[tmp+1]<=orz)
        {
            tmp++;
        }
        for (int i=L2-1;i>=0;i--)
        {
            if (nxt[tmp][i][x]==solve||(dp[tmp][i][x]!=MAX+10&&orz>=dp[tmp][i][x]))
            {
                continue;
            }
            orz+=take[tmp][i][x];
            x=nxt[tmp][i][x];
        }
        if (orz>=S[x-1])
        {
            orz+=S[x-1];
            x=W[x-1]+1;
        }
        else
        {
            orz+=P[x-1];
            x=L[x-1]+1;
        }
    }
    return orz;
}

Compilation message

fish.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //------------------------------------\\
      | ^
fish.cpp:12:10: fatal error: dungeons.h: No such file or directory
   12 | #include "dungeons.h"
      |          ^~~~~~~~~~~~
compilation terminated.