Submission #643084

# Submission time Handle Problem Language Result Execution time Memory
643084 2022-09-21T07:37:12 Z cologne Broken Device 2 (JOI22_device2) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

int Declare()
{
    return 2000;
}

int count(int N)
{
    if (N < 2)
        return 0;
    return 4 * (2 * N - 4 + 1);
}

pair<vector<int>, vector<int>> solve(int N, int A)
{
    int v = N / 3;
    vector<int> L(N), R(N);
    if (A % 2 == 1)
        L[0] = R[0] = 1;
    A /= 2;
    if (A % 2 == 1)
        L.back() = R.back() = 1;
    A /= 2;
    for (int i = 0; i < A; i++)
    {
        if (i < N - 2)
            L[i + 1] = 1;
        else
            R[i - (N - 2) + 1] = 1;
    }
    return {L, R};
}

pair<vector<int>, vector<int>> Anna(long long A)
{
    --A;
    for (int i = 1; i <= 2000; i++)
    {
        long long K = count(i);
        if (A >= K)
            A -= K;
        else
            return solve(i, A);
    }
    assert(false);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

extern int count(int N);

long long solve(vector<int> u)
{
    int N = u.size() / 2;
    int L = u[0], R = u.back();
    int C = count(u.begin(), u.end(), 1) - 2 * L - 2 * R;
    return 4 * C + 2 * R + L;
}
long long Bruno(vector<int> u)
{
    long long ans = 1;
    for (int i = 1; i < (int)u.size() / 2; i++)
        ans += count(i);

    return ans + solve(u);
}

Compilation message

Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > solve(int, int)':
Anna.cpp:19:9: warning: unused variable 'v' [-Wunused-variable]
   19 |     int v = N / 3;
      |         ^

Bruno.cpp: In function 'long long int solve(std::vector<int>)':
Bruno.cpp:9:9: warning: unused variable 'N' [-Wunused-variable]
    9 |     int N = u.size() / 2;
      |         ^
/usr/bin/ld: /tmp/ccT4NV5o.o: in function `Bruno(std::vector<int, std::allocator<int> >)':
Bruno.cpp:(.text+0xae): undefined reference to `count(int)'
collect2: error: ld returned 1 exit status