답안 #401810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
401810 2021-05-10T21:04:28 Z timmyfeng Amusement Park (JOI17_amusement_park) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

void Joi(int n, int m, vector<int> a, vector<int> b, long long x, int t) {
    vector<vector<int>> adj(n);
    for (int i = 0; i < m; ++i) {
        adj[a[i]].push_back(b[i]);
        adj[b[i]].push_back(a[i]);
    }

    vector<bool> visited(n);
    auto dfs = [&](int u, auto &self) -> void {
        MessageBoard(u, x % 2);
        x /= 2;

        visited[u] = true;
        for (auto c : adj[u]) {
            if (!visited[c]) {
                self(c, self);
            }
        }
    };

    dfs(1, dfs);
}
#include <bits/stdc++.h>
using namespace std;

const int L = 60;

long long Ioi(int n, int m, vector<int> a, vector<int> b, int p, int v, int t) {
    vector<vector<int>> adj(n);
    for (int i = 0; i < m; ++i) {
        adj[a[i]].push_back(b[i]);
        adj[b[i]].push_back(a[i]);
    }

    vector<int> path;
    vector<bool> visited(n);
    auto dfs_find = [&](int u, auto &self) -> bool {
        visited[u] = true;
        if (u == 1) {
            return true;
        }

        for (auto c : adj[u]) {
            if (!visited[c] && self(c, self)) {
                path.push_back(c);
                return true;
            }
        }
        return false;
    };

    dfs_find(p, dfs_find);

    reverse(path.begin(), path.end());
    for (auto u : path) {
        v = Move(u);
    }

    int i = 0;
    long long ans = 0;
    visited.assign(n, false);
    auto dfs_read = [&](int u, auto &self) -> bool {
        ans |= (long long) v << i;
        if (++i == L) {
            return true;
        }

        visited[u] = true;
        for (auto c : adj[u]) {
            if (!visited[c]) {
                v = Move(c);
                if (self(c, self)) {
                    return true;
                }
                v = Move(u);
            }
        }
    };

    dfs_read(1, dfs_read);

    return ans;
}

Compilation message

Joi.cpp: In lambda function:
Joi.cpp:13:9: error: there are no arguments to 'MessageBoard' that depend on a template parameter, so a declaration of 'MessageBoard' must be available [-fpermissive]
   13 |         MessageBoard(u, x % 2);
      |         ^~~~~~~~~~~~
Joi.cpp:13:9: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Joi.cpp: In instantiation of 'Joi(int, int, std::vector<int>, std::vector<int>, long long int, int)::<lambda(int, auto:23&)> [with auto:23 = Joi(int, int, std::vector<int>, std::vector<int>, long long int, int)::<lambda(int, auto:23&)>]':
Joi.cpp:24:15:   required from here
Joi.cpp:13:21: error: 'MessageBoard' was not declared in this scope
   13 |         MessageBoard(u, x % 2);
      |         ~~~~~~~~~~~~^~~~~~~~~~

Ioi.cpp: In function 'long long int Ioi(int, int, std::vector<int>, std::vector<int>, int, int, int)':
Ioi.cpp:34:13: error: 'Move' was not declared in this scope
   34 |         v = Move(u);
      |             ^~~~
Ioi.cpp: In lambda function:
Ioi.cpp:49:21: error: there are no arguments to 'Move' that depend on a template parameter, so a declaration of 'Move' must be available [-fpermissive]
   49 |                 v = Move(c);
      |                     ^~~~
Ioi.cpp:49:21: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Ioi.cpp:53:21: error: there are no arguments to 'Move' that depend on a template parameter, so a declaration of 'Move' must be available [-fpermissive]
   53 |                 v = Move(u);
      |                     ^~~~
Ioi.cpp: In instantiation of 'Ioi(int, int, std::vector<int>, std::vector<int>, int, int, int)::<lambda(int, auto:24&)> [with auto:24 = Ioi(int, int, std::vector<int>, std::vector<int>, int, int, int)::<lambda(int, auto:24&)>]':
Ioi.cpp:58:26:   required from here
Ioi.cpp:49:25: error: 'Move' was not declared in this scope
   49 |                 v = Move(c);
      |                     ~~~~^~~
Ioi.cpp:53:25: error: 'Move' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
   53 |                 v = Move(u);
      |                     ~~~~^~~
Ioi.cpp: In lambda function:
Ioi.cpp:56:5: warning: control reaches end of non-void function [-Wreturn-type]
   56 |     };
      |     ^