Submission #399619

# Submission time Handle Problem Language Result Execution time Memory
399619 2021-05-06T10:16:51 Z Collypso Painting Walls (APIO20_paint) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vt vector
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
//#define endl '\n'
#define int long long

using namespace std;

int minimumInstructions(int N, int M, int K, vt<int> C, vt<int> A, vt<vt<int>> B)
{
    vt<int> dp(N);

    for(int i = 0; i <= N - M; i++)
    {
        if (i > 0 && dp[i - 1] == 0) continue;
        for(int master = 0; master < M; master++)
        {
            int m = master;
            for(int j = i; j < N; j++, m = (m + 1) % M)
            {
                int tmp1 = lower_bound(all(B[m]), C[j]) - B[m].begin();
                if (B[m][tmp1] != C[j]) break;
                if ((j - i + 1) >= M)
                {
                    int tmp2 = i > 0 ? dp[i - 1] : 0;
                    int tmp3 = ((j - i + M) / M + tmp2);
                    dp[j] = dp[j] ? min(dp[j], tmp3) : tmp3;
                }
            }
        }
    }

    if (dp[N - 1]) return dp[N - 1];
    return -1;
}

/**
main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int ans = minimumInstructions(6, 4, 4, {2, 1, 0, 3, 2, 1}, {3}, {{2}, {1}, {0}, {3}});
    cout << ans << endl;
}
/**/

Compilation message

paint.cpp:50:1: warning: "/*" within comment [-Wcomment]
   50 | /**/
      |  
/tmp/ccuppFnw.o: In function `main':
grader.cpp:(.text.startup+0x27c): undefined reference to `minimumInstructions(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status