Submission #578413

# Submission time Handle Problem Language Result Execution time Memory
578413 2022-06-16T17:42:35 Z SSRS Werewolf (IOI18_werewolf) C++14
15 / 100
4000 ms 21444 KB
#include <bits/stdc++.h>
using namespace std;
vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R){
  int M = X.size();
  int Q = S.size();
  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++){
    G[X[i]].push_back(Y[i]);
    G[Y[i]].push_back(X[i]);
  }
  vector<int> ans(Q, 0);
  for (int i = 0; i < Q; i++){
    vector<bool> used1(N, false);
    used1[S[i]] = true;
    queue<int> q1;
    q1.push(S[i]);
    while (!q1.empty()){
      int v = q1.front();
      q1.pop();
      for (int w : G[v]){
        if (w >= L[i] && !used1[w]){
          used1[w] = true;
          q1.push(w);
        }
      }
    }
    vector<bool> used2(N, false);
    used2[E[i]] = true;
    queue<int> q2;
    q2.push(E[i]);
    while (!q2.empty()){
      int v = q2.front();
      q2.pop();
      for (int w : G[v]){
        if (w <= R[i] && !used2[w]){
          used2[w] = true;
          q2.push(w);
        }
      }
    }
    for (int j = 0; j < N; j++){
      if (used1[j] && used2[j]){
        ans[i] = true;
      }
    }
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 284 ms 712 KB Output is correct
11 Correct 160 ms 700 KB Output is correct
12 Correct 20 ms 708 KB Output is correct
13 Correct 327 ms 724 KB Output is correct
14 Correct 221 ms 708 KB Output is correct
15 Correct 242 ms 844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4058 ms 21444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 284 ms 712 KB Output is correct
11 Correct 160 ms 700 KB Output is correct
12 Correct 20 ms 708 KB Output is correct
13 Correct 327 ms 724 KB Output is correct
14 Correct 221 ms 708 KB Output is correct
15 Correct 242 ms 844 KB Output is correct
16 Execution timed out 4058 ms 21444 KB Time limit exceeded
17 Halted 0 ms 0 KB -