QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#795881#9810. Obliviate, Then Reincarnateucup-team3099#Compile Error//C++231.2kb2024-12-01 03:15:262024-12-01 03:15:26

Judging History

This is the latest submission verdict.

  • [2024-12-01 03:15:26]
  • Judged
  • [2024-12-01 03:15:26]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, q; cin >> n >> m >> q;
    vector<vector<pair<int, int>>> adj(n);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        int u = ((a % n) + n) % n;
        int v = (((u + b) % n) + n) % n;
        adj[u].push_back({v, b});
    }
    vector<int> vis(n);
    vector<int64_t> dis(n);
    vector<bool> good(n);
    auto DFS = [&](this const auto& DFS, int u, int64_t cur) -> bool {
        vis[u] = 1;
        dis[u] = cur;
        for (auto [v, w] : adj[u]) {
            if (vis[v] == 2) {
                good[u] = good[u] || good[v];
            } else if (vis[v] == 1 && cur + w != dis[v]) {
                good[u] = true;
            } else if (vis[v] == 0 && DFS(v, cur + w)) {
                good[u] = true;
            }
        }
        vis[u] = 2;
        return good[u];
    };
    for (int u = 0; u < n; u++) {
        if (vis[u] == 0) {
            DFS(u, 0);
        }
    }
    while (q--) {
        int u; cin >> u;
        u = ((u % n) + n) % n;
        cout << (good[u] ? "Yes\n" : "No\n");
    }
}

Details

answer.code: In function ‘int main()’:
answer.code:18:20: error: expected identifier before ‘this’
   18 |     auto DFS = [&](this const auto& DFS, int u, int64_t cur) -> bool {
      |                    ^~~~
answer.code:18:20: error: expected ‘,’ or ‘...’ before ‘this’
answer.code: In lambda function:
answer.code:19:13: error: ‘u’ was not declared in this scope
   19 |         vis[u] = 1;
      |             ^
answer.code:20:18: error: ‘cur’ was not declared in this scope
   20 |         dis[u] = cur;
      |                  ^~~
answer.code:26:39: error: use of ‘DFS’ before deduction of ‘auto’
   26 |             } else if (vis[v] == 0 && DFS(v, cur + w)) {
      |                                       ^~~
answer.code: In function ‘int main()’:
answer.code:35:16: error: no match for call to ‘(main()::<lambda(int)>) (int&, int)’
   35 |             DFS(u, 0);
      |             ~~~^~~~~~
answer.code:18:16: note: candidate: ‘main()::<lambda(int)>’
   18 |     auto DFS = [&](this const auto& DFS, int u, int64_t cur) -> bool {
      |                ^
answer.code:18:16: note:   candidate expects 1 argument, 2 provided