답안 #1043002

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1043002 2024-08-03T17:32:31 Z thatsgonzalez 늑대인간 (IOI18_werewolf) C++14
15 / 100
166 ms 51840 KB
#include <bits/stdc++.h>
 
using namespace std;
 
const int nmax = 1e5+100;
 
vector<vector<int>> g;
bitset <nmax> vis1, vis2;
bool res = false;
 
 
void dfs(int node, int l, int r, bool estado){
  if(!estado and node<l) return;
  if(estado and node>r) return;
 
  /*if(!estado)*/ vis1[node] = 1;
  //else vis2[node] = 1;
 
  for(auto &x: g[node]){
    if(vis1[x] /*and !estado*/) continue;
    //if(vis2[x] and estado) continue;
 
    /*if(x>=l and x<=r and !estado){
      dfs(x,endpoint,l,r,estado);
      dfs(x,endpoint,l,r,!estado);
    }
    else{*/
      dfs(x,l,r,estado);
    //}
 
  }
 
}
 
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 Q = S.size();
  int M = X.size();
  std::vector<int> ans(Q,0);
 
  g.resize(N);
  
  for(int i = 0; i<M; i++){
 
    g[X[i]].push_back(Y[i]);
    g[Y[i]].push_back(X[i]);
 
  }

  bitset<nmax> a,b;
 
  for(int q = 0; q<Q; q++){
 
    res = false;

    dfs(S[q],L[q],R[q],0);
    a = vis1;
    vis1.reset();
    dfs(E[q],L[q],R[q],1);
    b = vis1;
    vis1.reset();

    for(int i = 0; i<N; i++){
        if(a[i] and b[i]) {
            res = true; break;
        }
    }


    ans[q] = res;
    //vis2.reset();
 
  }
  g.clear();
 
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 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 153 ms 912 KB Output is correct
11 Correct 69 ms 856 KB Output is correct
12 Correct 14 ms 860 KB Output is correct
13 Correct 166 ms 860 KB Output is correct
14 Correct 84 ms 860 KB Output is correct
15 Correct 158 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 103 ms 51840 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 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 153 ms 912 KB Output is correct
11 Correct 69 ms 856 KB Output is correct
12 Correct 14 ms 860 KB Output is correct
13 Correct 166 ms 860 KB Output is correct
14 Correct 84 ms 860 KB Output is correct
15 Correct 158 ms 1104 KB Output is correct
16 Runtime error 103 ms 51840 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -