Submission #962266

# Submission time Handle Problem Language Result Execution time Memory
962266 2024-04-13T09:54:22 Z Ice_man Wombats (IOI13_wombats) C++14
Compilation error
0 ms 0 KB
/**
 ____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

//#include"wombats.h"
#include <set>
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include <cstdio>

#define maxn 5005
#define maxn2 205
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cerr<<"passed"<<endl;

#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")

using namespace std;

/**std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;

double timePassed()
{
    using namespace std::chrono;
    currT = high_resolution_clock::now();
    double time = duration_cast<duration<double>>(currT - startT).count();
    return time * TIME_MULT;
}*/

typedef pair <long long, int> pli;

int d[maxn];
int c, r;
int h[maxn][maxn2];
int v[maxn][maxn2];
//int dp[maxn][maxn2];


/**void dijkstra(int node)
{
    for(int i = 0; i < c; i++)
        d[i] = 1e9;
    d[node] = 0;

    for(int j = 0; j < r; j++)
    {
        set <int> q;
        for(int i = 0; i < c; i++)
            if(d[i] != 1e9)
                q.emplace(i);

        while(q.size())
        {
            int e = *q.begin();
            q.erase(q.begin());

            if(e + 1 < c)
                if(d[e + 1] > d[e] + h[j][e])
                {
                    d[e + 1] = d[e] + h[j][e];
                    q.emplace(e + 1);
                }

            if(e >= 1)
                if(d[e - 1] > d[e] + h[j][e - 1])
                {
                    d[e - 1] = d[e] + h[j][e - 1];
                    q.emplace(e - 1);
                }
        }

        if(j + 1 < r)
            for(int i = 0; i < c; i++)
                d[i] += v[j][i];

    }

    for(int i = 0; i < c; i++)
        dp[node][i] = d[i];
}*/


int dp[5001][5001][201];


void calc_row(int i , int k)
{
    for(int j = 1; j < c; j++)
        dp[i][j][k] = min(dp[i][j][k] , dp[i][j][k - 1] + h[j][k - 1]);
    for(int j = c - 2; j > -1; j--)
        dp[i][j][k] = min(dp[i][j][k] , dp[i][j][k + 1] , + h[j][k])
}




void calc_dp(int k)
{
    for(int i = 0; i < r; i++)
        for(int j = 0; j < c; j++)
            dp[k][j][i] = 1e9;
    dp[k][k][0] = 0;

    calc_row(k , 0);


    for(int i = 1; i < r; i++)
    {
        for(int j = 0; j < c; j++)
            dp[k][j][i] = dp[k][j][i - 1] + v[i - 1][j];

        calc_row(k , i);
    }
}



void init(int R, int C, int H[5000][200], int V[5000][200])
{
    r = R;
    c = C;

    for(int i = 0; i < r; i++)
        for(int j = 0; j < c; j++)
        {
            if(j + 1 < c)
                h[i][j] = H[i][j];

            if(i + 1 < r)
                v[i][j] = V[i][j];
        }

    for(int i = 0; i < c; i++)
        calc_dp(i);
}



void changeH(int P , int Q , int W)
{
    h[P][Q] = W;
    for(int i = 0; i < c; i++)
        calc_dp(i);
}

void changeV(int P , int Q , int W)
{
    v[P][Q] = W;
    for(int i = 0; i < c; i++)
        calc_dp(i);
}


int escape(int V1 , int V2)
{
    return dp[V1][V2][r - 1];
}


/**int main()
{

    #ifdef ONLINE_JUDGE /// promeni
        freopen("input.in", "r", stdin);
        freopen("taxi.out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    //startT = std::chrono::high_resolution_clock::now();





    return 0;
}*/

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
wombats.cpp: In function 'void calc_row(int, int)':
wombats.cpp:105:69: error: expected ';' before '}' token
  105 |         dp[i][j][k] = min(dp[i][j][k] , dp[i][j][k + 1] , + h[j][k])
      |                                                                     ^
      |                                                                     ;
  106 | }
      | ~                                                                    
In file included from /usr/include/c++/10/bits/stl_tree.h:63,
                 from /usr/include/c++/10/set:60,
                 from wombats.cpp:10:
/usr/include/c++/10/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
wombats.cpp:105:68:   required from here
/usr/include/c++/10/bits/stl_algobase.h:281:17: error: '__comp' cannot be used as a function
  281 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~