답안 #1065924

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065924 2024-08-19T13:11:05 Z blackslex 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 33896 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<int> 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]) 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]) 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:21:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   21 |       if (fw[cur] || cur > cr) return; fw[cur] = 1;
      |       ^~
werewolf.cpp:21:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   21 |       if (fw[cur] || cur > cr) return; fw[cur] = 1;
      |                                        ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 197 ms 912 KB Output is correct
11 Correct 87 ms 860 KB Output is correct
12 Correct 16 ms 856 KB Output is correct
13 Correct 233 ms 860 KB Output is correct
14 Correct 113 ms 860 KB Output is correct
15 Correct 225 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4041 ms 33896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 197 ms 912 KB Output is correct
11 Correct 87 ms 860 KB Output is correct
12 Correct 16 ms 856 KB Output is correct
13 Correct 233 ms 860 KB Output is correct
14 Correct 113 ms 860 KB Output is correct
15 Correct 225 ms 1112 KB Output is correct
16 Execution timed out 4041 ms 33896 KB Time limit exceeded
17 Halted 0 ms 0 KB -