제출 #255762

#제출 시각아이디문제언어결과실행 시간메모리
255762IgorIXylophone (JOI18_xylophone)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <dist.h>

#define all(x) (x).begin(), (x).end()

using namespace std;

typedef long long ll;

int n;

int okay(vector<int> q)
{
    int pos1 = 0, posn = 0;
    vector<int> cnt(n + 1);
    for (int i = 1; i <= n; i++)
    {
        if (q[i] < 1 || q[i] > n) return 0;
        cnt[q[i]]++;
        if (cnt[q[i]] == 2) return 0;
        if (q[i] == 1) pos1 = i;
        if (q[i] == n) posn = i;
    }
    return pos1 < posn;
}

void solve(int n0)
{
    n = n0;
    vector<int> a(n), b(n);
    for (int i = 1; i + 1 <= n; i++)
    {
        a[i] = query(i, i + 1);
    }
    for (int i = 1; i + 2 <= n; i++)
    {
        b[i] = query(i, i + 2);
    }
    vector<int> dir(n);
    dir[1] = 1;
    for (int i = 1; i + 2 <= n; i++)
    {
        if (b[i] == a[i] + a[i + 1]) dir[i + 1] = dir[i];
        else dir[i + 1] = dir[i] * (-1);
    }
    vector<vector<int> > ans;
    for (int i = 1; i <= n; i++)
    {
        vector<int> q(n + 1);
        q[1] = i;
        q[2] = dir[1] * a[1] + q[1];
        for (int j = 3; j <= n; j++)
        {
            q[j] = q[j - 1] + dir[j - 1] * a[j - 1];
        }
        if (okay(q)) ans.push_back(q);
    }
    for (int i = 1; i < n; i++) dir[i] *= -1;
    for (int i = 1; i <= n; i++)
    {
        vector<int> q(n + 1);
        q[1] = i;
        q[2] = dir[1] * a[1] + q[1];
        for (int j = 3; j <= n; j++)
        {
            q[j] = q[j - 1] + dir[j - 1] * a[j - 1];
        }
        if (okay(q)) ans.push_back(q);
    }
    for (auto e : ans)
    {
        for (int i = 1; i <= n; i++)
        {
            answer(i, e[i]);
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

xylophone.cpp:2:10: fatal error: dist.h: No such file or directory
 #include <dist.h>
          ^~~~~~~~
compilation terminated.