Submission #1065915

# Submission time Handle Problem Language Result Execution time Memory
1065915 2024-08-19T13:05:18 Z blackslex Werewolf (IOI18_werewolf) C++17
0 / 100
4000 ms 43112 KB
#include "werewolf.h"
#include<bits/stdc++.h>

using namespace std;

std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
                                std::vector<int> S, std::vector<int> E,
                                std::vector<int> L, std::vector<int> R) {
  int n = N, m = X.size(), q = S.size();
  vector<vector<int>> v(n, vector<int>());
  for (int i = 0; i < m; i++) v[X[i]].emplace_back(Y[i]), v[Y[i]].emplace_back(X[i]);
  vector<int> ans(q);
  for (int i = 0; i < q; i++) {
    int cs = S[i], ce = E[i], cl = L[i], cr = R[i];
    vector<bool> fh(n), fw(n);
    function<void(int, int)> dfs = [&] (int cur, int par) {
      if (fh[cur] || cur < cl) return; fh[cur] = 1;
      for (auto &e: v[cur]) {
        if (par == e) continue;
        dfs(e, cur);
      }
    };
    function<void(int, int)> dfs2 = [&] (int cur, int par) {
      if (fw[cur] || cur > cr) return; fw[cur] = 1;
      for (auto &e: v[cur]) {
        if (par == e) continue;
        dfs2(e, cur);
      }
    };
    dfs(cs, 0); dfs2(ce, 0);
    for (int j = 0; j < n; j++) ans[i] |= (fh[j] & fw[j]);
  }
  return ans;
}

Compilation message

werewolf.cpp: In lambda function:
werewolf.cpp:17:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   17 |       if (fh[cur] || cur < cl) return; fh[cur] = 1;
      |       ^~
werewolf.cpp:17:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   17 |       if (fh[cur] || cur < cl) return; fh[cur] = 1;
      |                                        ^~
werewolf.cpp: In lambda function:
werewolf.cpp:24:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   24 |       if (fw[cur] || cur > cr) return; fw[cur] = 1;
      |       ^~
werewolf.cpp:24:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   24 |       if (fw[cur] || cur > cr) return; fw[cur] = 1;
      |                                        ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4019 ms 43112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -